sql - PHP MySQL command syntax error -
this sql query not working:
$sql = "insert top(topic_subject,topic_date, topic_cat, topic_by) values(" . mysql_real_escape_string($_post['topic_subject']) . " , now()," . mysql_real_escape_string($_post['topic_cat']) . " , " . isset ($_session['user_id']) . ")";
how can fix it?. getting error message.
you have error in sql syntax; check manual corresponds mysql server version right syntax use near ')' @ line 2`
it's topic_subject character data. include literal strings in sql text, should enclosed in single quotes.
... values ('abc', ...
if used prepared statements, wouldn't issue, , love of all things beautiful , good in world, don't use deprecated php mysql_ interface new development. it's been superseded mysqli_ , pdo interfaces.
Comments
Post a Comment