UPDATE语句不起作用 [英] UPDATE statement not working
本文介绍了UPDATE语句不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个区域,管理员可以更改用户详细信息或删除用户,删除语句运行良好,另一方面更新不更新。
当我回应更新语句时,我得到:
I have a area where admin can change a users details or delete a user, the delete statement is working well, update on the other hand is not updating.
when i echo out the update statement I get :
UPDATE users SET username='superman', dob='0000-00-00', location='The Daily Planet ', group='2' WHERE id='136'
所以我知道数据是正确的开始过程,它只是不更新数据本身。
我的更新声明
so I know the data is begin process correctly, its just not updating the data itself.
My update statment
require 'core/init.php';
$username = mysql_real_escape_string($_POST["username"]);
$dob = mysql_real_escape_string($_POST["dob"]);
$location = mysql_real_escape_string($_POST["location"]);
$group = mysql_real_escape_string($_POST["group"]);
$user_id = (int)$_POST['id'];
$result = mysql_query("UPDATE users
SET username='$username',
dob='$dob',
location='$location',
group='$group'
WHERE
id='$user_id'");
echo "UPDATE users
SET username='$username',
dob='$dob',
location='$location',
group='$group'
WHERE
id='$user_id'"
//header("location:admin.php");
对我来说这很好看,但它阻止数据进入数据库。
To me this looks fine, but something it preventing the data entering the database.
推荐答案
用户名 = mysql_real_escape_string(
username = mysql_real_escape_string(
_POST [ username]);
_POST["username"]);
dob = mysql_real_escape_string(
dob = mysql_real_escape_string(
这篇关于UPDATE语句不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文