Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
in Plugins by
SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens

The error is generated in this part of the file q2apro-onsitenotifications-layer.php;

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%")' .

            $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;

I've solved a few problems, but this one I'm stuck with. Has anyone else made it work?

Q2A version: 1.8.5
If I'm not mistaken that error message would come from a prepared statement that expects a different number of arguments than were provided. But AFAICS Q2A doesn't use prepared statements, so how did you get that error?

Please log in or register to answer this question.