kangjacob 2022-10-09 16:50 采纳率: 96.8%
浏览 26
已结题

为什么不能插入mysql的表格?


<?php
require_once('dataBase.php');// 创建连接

$sql="INSERT INTO result_table(userName, yangxu, yinxu, shire, tanshi, qixu, qiyu, xueyu, tebing, pinghe, testTime, testDate )VALUES ('testname','12','12','12','12','12','12','12','12','12','12','201201201')";
$result=$conn->query($sql);

if ($conn->query($sql2) === TRUE) {
    echo "新记录插入成功";
} else {
    echo "Error: " . $sql2 . "
"
. $conn->error; } $conn->close(); ?>

想向自己数据库的表格 result_table中插入数据,数据连接已经成功,但总是无法插入,提示错误如下:
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 ', yangxu, yinxu, shire, tanshi, qixu, qiyu, xueyu, tebing, pinghe, testTime, tes' at line 1

请问谁知道症结所在么?谢谢!

  • 写回答

3条回答 默认 最新

  • 心寒丶 全栈领域优质创作者 2022-10-09 17:02
    关注

    中文括号吧

    img

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

问题事件

  • 系统已结题 10月17日
  • 已采纳回答 10月9日
  • 创建了问题 10月9日