У меня возникли проблемы с запуском этого запроса. Я продолжаю получать сообщение об ошибке: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";
Edit: Это таблица:
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 ;
Edit: Обновленный запрос, но теперь 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);
И адрес в адресной строке:
http://localhost:8888/wmin/msg.php?user_id=1&msg_id=2
Кто-нибудь увидеть, где я буду неправильно? Благодаря!
Думаю, я понимаю, о чем вы говорите. Я пробовал помещать backquotes вокруг него, не работал ... Я тогда попытался изменить имя столбца в таблице все еще ничего: / – Stephen