我在运行此查询时遇到问题。我不断收到错误:PHP + MYSQL:更新时出现问题查询
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'read = 'readd' WHERE user_id = '1' LIMIT 1' at line 1
代码
$conn = mysql_connect('localhost', 'admin', 'root') or die(mysql_error());
mysql_select_db('main') or die(mysql_error());
$read = "message read";
$set_statuss = "UPDATE inbox ".
"SET read = '".$read."' ".
"WHERE user_id = '".$_SESSION['user_id']."' ".
"LIMIT 1";
编辑:这是表:
CREATE TABLE `inbox` (
`inbox_id` int(5) NOT NULL auto_increment,
`posted_to` int(5) NOT NULL,
`posted_by` int(5) NOT NULL,
`subject` text NOT NULL,
`message` text NOT NULL,
`date_posted` datetime NOT NULL,
`read` text NOT NULL,
PRIMARY KEY (`inbox_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
编辑:更新了查询,但现在的PHP是只是表现为白色..
$read = "read";
$set_statuss = "UPDATE inbox ".
"SET read = '".$read."' ".
"WHERE posted_to = '{$_SESSION['user_id']}' AND inbox_id = '".$_GET['msg_id'];."' ";
mysql_query($set_statuss) or die(mysql_error() . $set_statuss);
并在地址栏中的URL:
http://localhost:8888/wmin/msg.php?user_id=1&msg_id=2
有谁看到我要去哪里错了吗?谢谢!
我想我明白你在说什么。我试过在它周围放置反引号,没有工作......然后我试图改变表中的列名仍然没有:/ – Stephen 2009-10-31 13:30:58