你好我有这个插入数据的功能:
function add_item($id, $name, $level, $img, $health, $mana, $stamia, $str, $int, $luc, $information, $gold, $tradeable, $faction)
{
if (isset($_SESSION['admin']))
{
global $pdo;
$check = $pdo->prepare("SELECT * FROM items WHERE item_id = :id AND item_name = :name");
$check->execute(array(":id" => $id, ":name" => $name));
/**
* Checking if row doesn't exists
**/
if (!$check->rowCount())
{
$insert = $pdo->prepare
("
INSERT INTO items
(item_id, item_name, item_level, item_thumbnail, date, time, health, mana, stamia, str, int, luc, information, tradeable, faction, price)
VALUES
(:id, :name, :level, :img, CURDATE(), CURTIME(), :health, :mana, :stamia, :str, :int, :luc, :information, :tradeable, :faction, :price)
");
$insert->execute(array
(
":id" => $id,
":name" => $name,
":level" => $level,
":img" => $img,
":health" => $health,
":mana" => $mana,
":stamia" => $stamia,
":str" => $str,
":int" => $int,
":luc" => $luc,
":information" => $information,
":tradeable" => $tradeable,
":faction" => $faction,
":price" => $gold
));
}
}
但是在它处理之后,我得到了这个错误:
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 'int, luc, information, tradeable, faction, price) VALUES ('34434', 'dre' at line 2
一切似乎都是正确的?..那里有什么问题?我看不出查询语法有任何问题。
谢谢。