Does mysql_num_row () always replace 0?

Source: Internet
Author: User
Mysql_num_row () is always 0 ?????? & Lt ;? Php & nbsp; $ reback = 0; & nbsp; $ name = $ _ GET [& quot; name & quot;]; & nbsp; $ password = $ _ GET [& quot; passwor 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.