Maison > Article > développement back-end > 人太菜,求改错解决思路
人太菜,求改错
写入到client.js中的一个函数:
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> //数据库查询相关 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("数据库查询失败!"); return false; }