Log in

View Full Version : Help with query for private message


DRJ
02-27-2006, 12:49 AM
I am trying to query the db for a value and have it displayed in the user/postbit section of a PM. I was able to do this for the Showthread, but not for PM.

I tried using this hook:

Hook Location : postbit_display_start

$kbcount = $db->query("SELECT *
FROM test_vba_kbentries
WHERE coder_id = $post[userid]
AND kb_approved = 1");
$post['kbentries'] = $db->num_rows($kbcount);

But I get this error:

Fatal error: Call to a member function on a non-object in /hsphere/local/home/vbaexpre/vbaexpress.com/forum/includes/class_postbit.php(251) : eval()'d code on line 14

Is $db not valid?

Thanks

Marco van Herwaarden
02-27-2006, 07:50 AM
Either use $vbulletin->db instead of $db, or add "global $db;" as the first line.

DRJ
02-27-2006, 12:25 PM
That worked. Thanks :)