得到了这个查询:
mysql_query("INSERT INTO leaderboard (user_id, lines)
VALUES (". $rowUser['id'] .",". $linesDone .")") or die("ERROR 29: ". mysql_error());
Run Code Online (Sandbox Code Playgroud)
给出这个错误:
ERROR 29: 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 'lines) VALUES (1,50)' at line 1
Run Code Online (Sandbox Code Playgroud)
我已经尝试过所有类型的语法,比如在查询中使用''和'',但所有的结果都是大约.同样的错误.
任何人都可以看到有什么问题?
行是MySQL中的保留字 - 你必须用反引号来逃避这个词
mysql_query("INSERT INTO leaderboard (user_id, `lines`)
VALUES (". $rowUser['id'] .",". $linesDone .")") or die("ERROR 29: ". mysql_error());
Run Code Online (Sandbox Code Playgroud)
btw .. mysql_*已弃用,如手册中所述.更好地使用mysqli_*或pdo
| 归档时间: |
|
| 查看次数: |
57 次 |
| 最近记录: |