When querying data from MYSQL, using mysql_query() always returns false, but is there no problem with the SQL statement?
“Arvin
“Arvin 2018-11-22 22:57:45
0
1
1537

//Create database connection

$conn=mysql_connect("localhost","arvin","123");

// Determine whether the data inventory connection is normal

if(!$conn)

{

die('Could not connect:'.mysql_error());

}

//Open the database

$selected=mysql_select_db("study",$conn);

//Write SQL statement

$sql1="select * from phone";

$result=mysql_query($sql1,$conn);

var_dump($result)1542898645295133.jpg;

?>



“Arvin
“Arvin

reply all (1)
Summer

I have never written a native database connection, but I feel that selecting a database is not used here

  • reply I changed the PHP version to 7.2 and then used mysqli_query() and it became normal. . As for the previous one, I don’t know what the problem was. I can only use the higher version temporarily to check.
    “Arvin author 2018-11-23 10:08:35
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!