你好我正在运行一个服务器端数据库来处理来自安卓手机的输入。我有两个功能,一个是存储用户信息,一个是更新他们的位置。
第二个存储位置我无法上班。
/**
* Storing new user
* returns user details
*/
public function storeUser($name, $email, $password) {
$uuid = uniqid('', true);
$hash = $this->hashSSHA($password);
$encrypted_password = $hash["encrypted"]; // encrypted password
$salt = $hash["salt"]; // salt
$result = mysql_query("INSERT INTO users(unique_id, name, email, encrypted_password, salt, created_at) VALUES('$uuid', '$name', '$email', '$encrypted_password', '$salt', NOW())");
// check for successful store
if ($result) {
// get user details
$uid = mysql_insert_id(); // last inserted id
$result = mysql_query("SELECT * FROM users WHERE uid = $uid");
// return user details
return mysql_fetch_array($result);
} else {
return false;
}
}
/**
* Updating a users
* location
*/
public function updateLocation($email, $location) {
$uuid = uniqid('', true);
$result = mysql_query("UPDATE users SET location='$location' WHERE email='$email' NOW())");
// check for successful store
if ($result) {
// get user details
$uid = mysql_insert_id(); // last inserted id
$result = mysql_query("SELECT * FROM users WHERE email = $email");
// return user details
return mysql_fetch_array($result);
} else {
return false;
}
}
非常感谢任何帮助。
谢谢