我正在修改“Question2Answer”脚本的插件,激活插件后,出现以下错误:
MySQL query error HY093: SQLSTATE [HY093]: Invalid parameter number: number of bound variables does not match number of tokens - Query: SELECT COUNT(event) FROM qa_eventlog WHERE datetime >= FROM_UNIXTIME(? ) AND ((userid = ? AND event LIKE "in_%") OR (event IN ("u_message", "u_wall_post") AND params LIKE "userid=?\t%"), referer: http://rankeo.test/index.php?qa=questions
生成此类代码的函数如下所示:
private function getEventCount($last_visit, $userid)
{
$currentTime = (int)qa_opt('db_time');
$maxageTime = $currentTime - (int)qa_opt('q2apro_onsitenotifications_maxage') * 86400;
$fromTime = max($maxageTime, $last_visit);
$eventlogCount = qa_db_read_one_value(qa_db_query_sub(
'SELECT COUNT(event) FROM ^eventlog ' .
'WHERE datetime >= FROM_UNIXTIME(#) AND (' .
'(userid = # AND event LIKE "in_%") OR ' .
'(event IN ("u_message", "u_wall_post") AND params LIKE "userid=#\t%")' .
')',
$last_visit,
$userid,
$userid
));
$pluginCount = qa_db_read_one_value(qa_db_query_sub(
'SELECT COUNT(*) FROM ^q2apro_osn_plugin_notifications ' .
'WHERE user_id = # AND created_at >= FROM_UNIXTIME(#)',
$userid, $fromTime
));
return $eventlogCount + $pluginCount;
}
知道我做错了什么吗?
谢谢!