Mysql_num_row () is always 0 ?????? & Lt ;? Php & nbsp; $ reback0; & nbsp; $ name $ _ GET [& quot; name & quot;]; & nbsp; $ password $ _ GET [& quot; password & quot;]; & nbsp; $ connmysql_co mysql_num_row () is always 0 ??????
$ Reback = 0;
$ Name = $ _ GET ["name"];
$ Password = $ _ GET ["password"];
$ Conn = mysql_connect ("localhost", "root ","");
If (! $ Conn ){
Die ("Connot connect server:". mysql_error ());
}
Mysql_select_db ("db_music", $ conn) or die ("Cannot select database:". mysql_errno ());
Mysql_query ("set names gb2312 ");
$ SQL = "select * from tb_user where name = '". $ name. "' and pd = '". $ password ."'";
Echo $ SQL;
// Echo $ SQL;
$ Result = mysql_query ($ SQL, $ conn );
$ Num = mysql_num_rows ($ result );
Mysql_close ($ conn );
// Echo $ num;
If ($ num = 1 ){
$ Reback = "welcome". $ name. "user login! ";
} Else {
$ Reback = "incorrect user name or password! ";
}
Echo $ reback;
?>
The database contains correct data, but echo $ num is always 0;
$ SQL can be output correctly and checked correctly, and the query results can be run independently in mysql ......
Please kindly advise ....
------ Solution --------------------
Echo $ SQL;
Post result
------ Solution --------------------
How are you sure you are.