php mysql_query() problem
移动用户-4895127
移动用户-4895127 2019-12-17 08:01:01
0
4
1187

phpstudy mysql connection successful
navicat mysql connection phpstudy mysql no problem
The table is
id username gender pass
1 bule man 111

php里
conn. php file:
Connect to phpstudy database:
Use $link= mysqli_connect(); there is no problem in verification after connection

dologin.php file:
Define the query statement after calling conn.php:
$sql="select * from yq ";

Execute the query statement:
$ result= mysqli_query($link,$sql);
Then something goes wrong.

移动用户-4895127
移动用户-4895127

reply all(2)
移动用户-4895127

Problems arise when dologin.php imports conn.php. Just connect to the database directly in dologin.php. This is the sentence to quote a file in the same directory, right? include_once("./conn.php");

微笑°

Then I guess you didn’t specify it in your library.

  • reply Specified, I verified it in the conn.php file if($link){ echo "Database connection successful"; } The result shows: database connection successful There is a problem here with mysql_query(). I can query the defined query statement separately in the mysql table without any problem. It seems that the conn.php file cannot be called and the table is not found. I directly put it in dologin.php. $link= mysql_connect("localhost","root","123456","yq"); can be executed mysql_query() can be executed, and a verification is added afterwards $rowcount= mysql_num_rows($ result); printf("A total of %d rows of data returned",$rowcount); The results show: A total of 0 rows of data were returned
    移动用户-4895127 author 2019-12-17 14:42:55
  • reply I don’t know if conn.php cannot import dologin.php or something else. question
    移动用户-4895127 author 2019-12-17 14:44:56
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!