我的PHP插入数据库功能不工作


my PHP insert to DB function does not work

我创建了一个Android客户端应用程序和一个PHP Webservice,我只是发送一些用户信息到Webservice登录或注册,我的客户端很好,但没有错误连接和调用Webservice和客户端参数也很好,我的登录功能(选择函数)在服务器上也很好,没有错误;但是在php webservice上的插入函数不工作,请帮助我,我该怎么办?每次我调用寄存器函数,我收到"数据库错误"。下面是我在webservice中的插入函数:

// RPC method 1 (register)
function reguser($email, $password, $tell, $fp, $long, $lat, $ckey) {
    $id=22;
    $vercode = createRandom();
    $db = mysql_connect("localhost","root");
    if(!$db){
        return 'Error: cannot open the connection to DB';
        exit;
    }
    // insert new user in DB
    mysql_select_db('user_info');
    $query = "insert into personal(id, email, password, tell, fp, long, lat, vercode, ckey) values ('".$id."', '".$email."', '".$password."', '".$tell."', '".$fp."', '".$long."', '".$lat."', '".$vercode."', '".$ckey."')";
    $result = mysql_query($query);
     if($result){
         return 'ok'; 
     } 
        else {
            return 'Database error';
        }
}

试试这个。在查询中使用引号作为列名

insert into personal(`id`, `email`, `password`, `tell`, `fp`, `long`, `lat`, `vercode`, `ckey`)