Rentai food, please correct and write it to the client. a function in js: functionsqlUserInfo ($ username, $ password) {$ userstrim ($ username); $ passtrim ($ password); $ connmysql_connect ($ host, $ Rentai food, please correct
A function written to client. js:
JScript code
// Function sqlUserInfo ($ username, $ password) {$ users = trim ($ username); $ pass = trim ($ password ); $ conn = mysql_connect ($ host, $ users, $ passwords); mysql_select_db ($ database, $ conn); // echo "start connect db"; if (! $ Db) return false; // echo "start query db"; $ query = "SELECT * FROM tb_users WHERE username = '". $ users. "'AND password = '". $ pass. "'"; $ SQL = mysql_query ($ query, $ conn) or die (mysql_error (); if (mysql_num_rows ($ SQL) = 1) return true; else die ("database query failed! "); Return false ;}
Error prompt:
Missing name after. operator
... ELECT * FROM tb_users WHERE username = '". $ users."' AND password = '". $ pass ."'"
---------------------------------------------------- Success
The arrow points to the position behind $ users. I don't understand what went wrong. Correction
------ Solution --------------------
If (! $ Db) // $ db undefined
Return false;
What makes me wonder is that this is the php code and should be placed on the server side.
Why is there a function written to client. js ". Very incomprehensible