[英]MySQL syntax error, for no apparent reason
I have this MySQL statement writen in PHP, but it seems to contain a syntax-error. 我已经用PHP写了这个MySQL语句,但是它似乎包含语法错误。
$user_forum_sql = ( !empty($forum_id) ) ? " WHERE session_page = " . intval($forum_id) : '';
$sql = "SELECT * FROM " . $session_table_name . '"'.$user_forum_sql.'"';
This is the error I'm having. 这是我的错误。 I'm not sure what is causing it. 我不确定是什么原因造成的。
SQL Error : 1064 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 '""' at line 1
SELECT * FROM ""
$user_forum_sql = ( !empty($forum_id) ) ? " WHERE session_page = " . intval($forum_id) .'' ;
$sql = "SELECT * FROM " . $session_table_name.$user_forum_sql;
echo $sql;
Your $session_table_name is empty, so you might have not started your session or have not set the value. 您的$ session_table_name为空,因此您可能尚未启动会话或未设置值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.