5

有人可以发现错误:

mysqli_query($connection, "INSERT INTO comments (event_id, fulltext, date_posted) VALUES (5, 'Hallo', 430234)");

连接已建立,但它只是不插入新行。

include("../../connect.php");

$event_id = intval($_GET["event_id"]);
$fulltext = $_GET["fulltext"];
$date = intval($_GET["date"]);

mysqli_query($connection, "INSERT INTO comments ('event_id', 'fulltext', 'date_posted') VALUES (5, 'Hallo', 430234)");

echo "INSERT INTO comments (event_id, fulltext, date_posted) VALUES (5, 'Hallo', 430234)";

mysqli_close($connection);
4

1 回答 1

6

FULLTEXTmysql中的保留字,您不能将其用作列名,在查询下方使用`周围的列名

mysqli_query($connection, "INSERT INTO comments 
(`event_id`, `fulltext`, `date_posted`) VALUES (5, 'Hallo', 430234)");
于 2013-04-04T06:21:58.380 回答