有人可以发现错误:
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);
答案 0 :(得分:5)
FULLTEXT 是 mysql 中的保留字,您不能将其用作列名称,使用`
列名称旁边的<{1}}
mysqli_query($connection, "INSERT INTO comments
(`event_id`, `fulltext`, `date_posted`) VALUES (5, 'Hallo', 430234)");