$sql = "INSERT INTO `call-request`(`mob`, `dat`, `nam`) VAULES( `hello`, `hi`, `he`)";
$result = $db->exec($sql);
$insertId = $db->lastInsertId();
收到此错误
DB:SQLSTATE[42000]: Syntax error or access violation: 1064 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 'VAULES( 'hello', 'hi', 'he')' at line 1
我没有使用任何关键字,请帮助
$sql = "INSERT INTO `call-request`(`mob`, `dat`, `nam`) VAULES( `hello`, `hi`, `he`)";
瓦勒斯
它应该是值
查询应如下所示 -
$sql = "INSERT INTO `call-request`(`mob`, `dat`, `nam`) VALUES( 'hello', 'hi', 'he')";
$result = $db->query($sql);
对于值,您必须使用单引号或双引号而不是'
使用 '
引用字符串文字和拼写错误VALUES
:
$sql = "INSERT INTO `call-request`(`mob`, `dat`, `nam`) VALUES( 'hello', 'hi', 'h')";