脚本更新客户端不工作的mysql
1 - 更新我的mysql客户端脚本 2 - 当我离开(其中id = id“;)我加倍了其他id只是使他们相同的变化。 。客户的个人资料,我知道这个问题,但不知道要放什么东西在那里,我试了MENY选项和仍然无法正常工作, 3 - 这里是我的脚本:脚本更新客户端不工作的mysql
<?php include('../conect.php');
if(isset($_POST['update']))
// Get values from form
$id=$_POST['id'];
$username=$_POST['username'];
$utilizator=$_POST['utilizator'];
$password=$_POST['password'];
$nivel=$_POST['nivel'];
$departament=$_POST['departament'];
$location=$_POST['location'];
$country=$_POST['country'];
$email=$_POST['email'];
$ip=$_POST['ip'];
$query = "UPDATE utilizatori SET username = '$username', utilizator = '$utilizator', password = '$password', nivel = '$nivel', departament = '$departament', location = '$location', country = '$country', email = '$email', ip = '$ip' where id= id";
$res = mysql_query($query);
mysql_query($update);
echo $update;
mysql_query($query);
echo "Record Updated";
header('location:../user.php');
// close connection
mysql_close();
?>
回答:
试试这个:
<?php include('../conect.php');
if(isset($_POST['update'])){
// Get values from form
$id=$_POST['id'];
$username=$_POST['username'];
$utilizator=$_POST['utilizator'];
$password=$_POST['password'];
$nivel=$_POST['nivel'];
$departament=$_POST['departament'];
$location=$_POST['location'];
$country=$_POST['country'];
$email=$_POST['email'];
$ip=$_POST['ip'];
$query = "UPDATE utilizatori SET username = '$username', utilizator = '$utilizator',
password = '$password', nivel = '$nivel', departament = '$departament',
location = '$location', country = '$country', email = '$email', ip = '$ip'
where id= $id";
$res = mysql_query($query);
if ($res) {
echo "Record Updated";
} else {
echo "Record not updated.";
}
header('location:../user.php');
} // end of first if statement
// close connection
mysql_close();
?>
回答:
你是不是引用$id
变量,而是一个字符串文本id
,它打破了查询语句,添加一个美元符号来引用该变量,如果它不是一个整数,它也用单引号括起来。
$query = "UPDATE utilizatori SET username = '$username', {...}, ip = '$ip' where id= '$id' ";
以上是 脚本更新客户端不工作的mysql 的全部内容, 来源链接: utcz.com/qa/260003.html