PHP错误尝试更新表

时间:2018-06-30 16:39:09

标签: php sql

我在尝试调用以下php脚本时遇到500 Internal Server Error,由于我只是得到一个空的主体,所以我不明白我的错误在哪里。希望你能帮我

<?php
$id=$_POST['id'];
$password=$_POST['password'];
$pass = md5($password);
$email=$_POST['email'];
$profilepicture=$_POST['profilepicture'];


$conn = mysqli_connect(connection);

if ($conn->connect_error) {
 die("Connection failed: " . $conn->connect_error);
} 

$updates = array();
if (!empty($password))
$updates[] = 'password="'.mysql_real_escape_string($password).'"';
if (!empty($email)) $updates[] = 'email="'.mysql_real_escape_string($email).'"';
if (!empty($profilepicture))
$updates[] = 'profilepicture="'.mysql_real_escape_string($profilepicture).'"'; 
$updates = implode(', ', $updates);

$sql ="UPDATE users SET $updates WHERE id='".$userid."'";

if ($conn->query($sql) === TRUE) {
    echo "Record updated successfully";
} else {
    echo "Error updating record: " . $conn->error;
}

$conn->close();
?>

rested的我发帖请求的屏幕截图(使用后发方法):

Screenshot rested

0 个答案:

没有答案