sqlite php正在获取无法识别的令牌:“quot;”&引用;插入和参数化查询时出错

sqlite php正在获取无法识别的令牌:“quot;”&引用;插入和参数化查询时出错,php,sqlite,Php,Sqlite,我第一次使用sqlite 准备查询字符串,如 $articleInsertQuery = "INSERT INTO Articles VALUES (?, ?, ?, ?, ?)", ($i, $title, $content, $date, 93,); 它返回“解析错误”。我也尝试过不传递参数化查询,比如 $articleInsertQuery = "INSERT INTO Articles VALUES ($i, $title, $content, $date, 93)"; 无法准备语句

我第一次使用sqlite

准备查询字符串,如

$articleInsertQuery = "INSERT INTO Articles VALUES (?, ?, ?, ?, ?)", ($i, $title, $content, $date, 93,);
它返回“解析错误”。我也尝试过不传递参数化查询,比如

$articleInsertQuery = "INSERT INTO Articles VALUES ($i, $title, $content, $date, 93)";
无法准备语句:1,无法识别的令牌:“:”


你知道我哪里做错了吗?

@arnoldIf你是用PDO做的

执行查询的方法如下所示

$dbObject = new PDO('sqlite:sqlitedb');// NEW LINE
$articleInsertQuery = "INSERT INTO Articles VALUES (?, ?, ?, ?, ?)";
$query = $dbObject->prepare($articleInsertQuery);
$query->execute(array($i, $title, $content, $date, 93));
编辑:


希望这有帮助。

您是否使用了任何函数来实现这一点?如果是,请显示。$query=$dbObject->prepare($articleInsertQuery);$query->execute();嘿@arnold,从哪个类?类AppDBClass扩展了SQLite3{function}uuuu construct(){$this->open('../Server/db/SQLite3_database.db');}}和$dbObject=new AppDBClass();对于第一个解决方案,它返回PHP警告:SQLite3Stmt::execute()只需要0个参数,1个given@arnold... 试试下面这个,就像$query->execute();对吗?是的,对不起。。。复制/粘贴问题。我得到这个SQLite3Stmt::execute():无法执行语句:约束失败
$articleInsertQuery = "INSERT INTO Articles VALUES (:i, :title, :content, :date, :int)";
$query = $dbObject->prepare($articleInsertQuery);
$query->bindValue(':i', $i, SQLITE3_INTEGER);
$query->bindValue(':title', $title, SQLITE3_TEXT);
$query->bindValue(':content', $content, SQLITE3_TEXT);
$query->bindValue(':date', $date, SQLITE3_TEXT);
$query->bindValue(':int', 93, SQLITE3_INTEGER);    

$result = $query->execute();