谁能找出错误:
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);
最佳答案
FULLTEXT 是 mysql 中的保留字,您不能将它用作列名,在下面的查询中使用 `
列名
mysqli_query($connection, "INSERT INTO comments
(`event_id`, `fulltext`, `date_posted`) VALUES (5, 'Hallo', 430234)");
关于php - 使用 MySQLi 将行插入 MySQL 数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15803853/