Home  >  Q&A  >  body text

php mysql_query() problem


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移动用户-48951271737 days ago1195

reply all(4)I'll reply

  • 移动用户-4895127

    移动用户-48951272019-12-17 15:01:55

    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");

    reply
    0
  • 微笑°

    微笑°2019-12-17 09:06:02

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

    reply
    0
  • 移动用户-4895127

    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 · 2019-12-17 14:42:55
    移动用户-4895127

    I don’t know if conn.php cannot import dologin.php or something else. question

    移动用户-4895127 · 2019-12-17 14:44:56
  • Cancelreply