php – 使用MySQLi将行插入MySQL数据库
发布时间:2020-12-13 17:23:47 所属栏目:PHP教程 来源:网络整理
导读:有人可以发现错误: 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[
有人可以发现错误:
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,430234)"); echo "INSERT INTO comments (event_id,430234)"; mysqli_close($connection); 解决方法
FULLTEXT是mysql中的保留字,你不能使用它作为列名使用下面的查询与`around column name
mysqli_query($connection,"INSERT INTO comments (`event_id`,`fulltext`,`date_posted`) VALUES (5,430234)"); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |