gpt4 book ai didi

php - 错误的 SQL 语法?

转载 作者:行者123 更新时间:2023-11-29 02:27:58 26 4
gpt4 key购买 nike

<分区>

我正在构建一个小型 Twitter 克隆供个人使用,但我遇到了很多麻烦。首先,我想向您展示表“poke_history”的 SQL 结构:
http://puu.sh/3Sci0.png

这是我用来将值插入表中的命令(在 PHP 中):

$insert = "INSERT INTO poke_history (id, from, time, reason) VALUES ('".$to_id."', '".$from_id."', '".$time."', '".$reason."')";
mysql_query($insert) or die(mysql_error());

这是我遇到的恼人错误:

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 'from, time, reason) VALUES ( '1'' at line 3.

让我澄清一些事情。
$to_id 是一个数字。
$from_id 是一个数字。
$time 是一个数字(来自 PHP 的 time())。
$reason 是一个文本字符串。

我正在使用 MySQL 和 PHP5。

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com