完整错误信息:
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
所以它并没有真正告诉我太多...有没有办法找到更多信息?
它已从两个 PHP 文件返回此消息。以下是我在每个文件中进行的第一个 MySQL 查询:
$query = mysql_query("SELECT * FROM `questions` WHERE `id`=".$currentId.";") or die( mysql_error() );
$query = mysql_query("SELECT * FROM `questions` WHERE `id`=".$theNextId.";") or die( mysql_error() );
虽然在此之前有 PHP 代码打开数据库等。
这里有一个类似的问题:Link
也许我的串联有误?
谢谢。
最佳答案
$currentId 为空。 不要忘记 SQL 注入(inject)!
关于php - 神秘的 MySQL 错误 "near ' '在第 1 行”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8904918/