Php + mysql implements the authentication code. Copy the code as follows :? Php $ uname $ _ POST [username]; $ pwd $ _ POST [password]; $ linkmysql_connect (localhost, root, 123456) ordie (Couldnotconnect:. mysql_error (
The code is as follows:
$ Uname = $ _ POST ["username"];
$ Pwd = $ _ POST ["password"];
$ Link = mysql_connect ('localhost', 'root', '123 ')
Or die ('could not connect: '. mysql_error ());
Mysql_select_db ('ruida ') or die ('could not select database ');
// Execute SQL query
$ Query = 'select * FROM user ';
$ Result = mysql_query ($ query) or die ('query failed: '. mysql_error ());
While ($ row = mysql_fetch_array ($ result )){
If ($ uname = $ row ['username'] & $ pwd = $ row ['password'])
{
// Page jump
}
Else
Echo 'error! ';}
// Release the result set
Mysql_free_result ($ result );
// Close the connection
Mysql_close ($ link );
?>
The http://www.bkjia.com/PHPjc/321444.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/321444.htmlTechArticle code is as follows :? Php $ uname = $ _ POST ["username"]; $ pwd = $ _ POST ["password"]; $ link = mysql_connect ('localhost', 'root ', '000000') or die ('could not connect :'. mysql_error (...