PDO query failed! The code is as follows:
Prepare ($ SQL); $ stm-> execute (array ($ name, $ password); $ rs = $ stm-> fetch (); var_dump ($ rs ); if (empty ($ rs) {echo "script alert ('query failed'); script";} else {echo "script" alert ('query succeeded '); script ";}?>
Admin table
Now the question is: If fetch is obtained, use empty to judge that false is returned. why?
Reply to discussion (solution)
Come on...
$ SQL = "select * from admin where user_name =? And password =? ";
What is this query?
Comment out error_reporting (0 );
Add print_r ($ db-> errorinfo () to lines 16 and 17 ());
$ SQL = "select * from admin where user_name =? And password =? ";
What is this query?
Query whether the user exists in the admin table! User name and md5-encrypted password
Comment out error_reporting (0 );
Add print_r ($ db-> errorinfo () to lines 16 and 17 ());
After adding a great God, the output is as follows: Array ([0] => 00000 [1] => [2] =>). What are the problems?
It indicates that no error has occurred.
Therefore, we can assume that your table does not have a qualified record.
It indicates that no error has occurred.
Therefore, we can assume that your table does not have a qualified record.
The field length is set to be less, and the md5 encrypted password is 32 characters. I only gave 30 characters, so the password is missing 2 characters! Thank you!