0

无法使用以下代码更新我的表...已经尝试了几个小时... tagboard是表名,mytag1是我要参考emailadd更新的内容。

$myemail = mysql_real_escape_string( $_POST["myemail"] );
$mytag1 = mysql_real_escape_string( $_POST["mytag1"] );
echo $mytag1;
$query = "UPDATE tagboard SET mytag1='{$mytag1}' WHERE emailadd = {$myemail}";
$result=mysql_query($query);

或者

$sql="UPDATE tagboard SET mytag1 ='".$_POST['mytag1']."' WHERE  myemail='".$_POST['myemail']."'";
$result=mysql_query($sql);

感谢你的帮助!

4

2 回答 2

1

在查询中的电子邮件地址字段周围添加引号:

$query = "UPDATE tagboard SET mytag1='{$mytag1}' WHERE emailadd = '{$myemail}'";
于 2013-10-10T19:32:33.590 回答
0

你有这一行:

$query = "UPDATE tagboard SET mytag1='{$mytag1}' WHERE emailadd = {$myemail}";

尝试在 email 变量周围加上单引号

$query = "UPDATE tagboard SET mytag1='{$mytag1}' WHERE emailadd = '{$myemail}'";
于 2013-10-10T19:32:46.213 回答