<?php
include '../Config/config1.php';
include '../Config/config.php';
include '../Config/connect.php';
$IDUser = ($_POST["IDUser"]);
$Names = ($_POST["Names"]);
$Address = ($_POST["Address"]);
$Email = ($_POST["Email"]);
$Role = ($_POST["Role"]);
$Activate = ($_POST["Activate"]);
$query2= $dbo->query("UPDATE user SET
Names='$Names', Address='$Address',Email='$Email'
,Role='$Role',Activate='$Activate' WHERE userid='$IDUser'");
if($query2){
echo "<script>alert('Profile Updated')</script>";
echo "<script>location.href='../UserProfile.php?
id=$IDUser'</script>";
}else{
echo "<script>alert('No Profile Updated')</script>";
echo "<script>location.href='../UserProfile.php?
id=$IDUser'</script>";
}
?>
答案 0 :(得分:0)
在使用变量的值中使用双引号,并始终尝试使用``作为列名。这是一个例子。
$query2= $dbo->query('UPDATE user SET `Names`="$Names" WHERE `userid`="$IDUser"');
还要确保在查询之前已创建$ dbo对象