人太菜,求改错解决思路

WBOY
Release: 2016-06-13 13:37:05
Original
932 people have browsed it

人太菜,求改错
写入到client.js中的一个函数:

JScript code
<!--

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;
}

Copy after login


提示出错:

missing name after . operator


...ELECT * FROM tb_users WHERE username = '".$users."' AND password = '".$pass."'"

----------------------------------------------------↑
箭头指向的是$users.的后面这个位置。不明白那里错了。求更正

------解决方案--------------------
if(!$db) // $db 未定义
return false;
让我纳闷的是,这是php的代码,应该放在服务器端呀。
怎么有 “写入到client.js中的一个函数”。 非常极其不理解
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template