尝试执行此操作时:
// make unread notifications
$db->sqlquery("SELECT `participant_id` FROM `user_conversations_participants` WHERE `conversation_id` = ? AND `participant_id` != ?", array($_POST['conversation_id'], $_SESSION['user_id']));
while ($participants = $db->fetch())
{
$db->sqlquery("UPDATE `user_conversations_participants` SET `unread` = 1 WHERE `participant_id` = ?", array($participants['participant_id']));
}
我似乎收到了这个错误:
警告:PDOStatement::fetch() [pdostatement.fetch]: SQLSTATE[HY000]: 第 68 行 /home/gamingon/public_html/prxa.info/includes/class_mysql.php 中的一般错误
这是我的查询和获取功能:
// the main sql query function
public function sqlquery($sql, $objects = array())
{
global $core;
try
{
$this->STH = $this->database->prepare($sql);
foreach($objects as $k=>$p)
{
// +1 is needed as arrays start at 0 where as ? placeholders start at 1 in PDO
if(is_numeric($p))
{
$this->STH->bindValue($k+1, (int)$p, PDO::PARAM_INT);
}
else
{
$this->STH->bindValue($k+1, $p, PDO::PARAM_STR);
}
}
$this->counter++;
return $this->STH->execute();
}
catch (Exception $e)
{
$core->message($e->getMessage());
}
}
public function fetch()
{
$this->STH->setFetchMode(PDO::FETCH_ASSOC);
**return $this->STH->fetch();**
}