PDA

View Full Version : fatal error help


killa seven
04-10-2010, 04:00 AM
sory for bothering you all again but

this is the error i get

Fatal error: Call to a member function query_read() on a non-objec

and this is the code i used

i am adding this as a plugin under the postbit_display_complete hook


$results = $vbulletin->db->query_read("SELECT username,beat,cscore,oscore FROM" . TABLE_PREFIX ." dbh_victims WHERE username = '" .$post[username]. "' ORDER BY beat ASC");


this is weird because i had it working using the exact same code and hook...

Lynne
04-10-2010, 02:44 PM
You'd be better off doing a join to the $posts, I would think - one less query per post. But anyway, I think you just need to make $vbulletin global first:

global $vbulletin;

killa seven
04-10-2010, 03:15 PM
i thought $post only worked for the custom fields like age, post, location ect,,

it would of been much easier if i can use $post for the table i set up in the database

that got rid of the query_read error but fetch array is still a problem

Fatal error: Call to a member function fetch_array() on a non-object in C:\xampp\htdocs\forums\includes\class_postbit.php( 294) : eval()'d code on line 6

Lynne
04-10-2010, 04:17 PM
Try hooking into the query for the $post. That is what I'm talking about.

As for your other error, I have no idea why you get it since you never posted the full code to your plugin.

killa seven
04-10-2010, 04:22 PM
im leaning towards hooking into the $post query but heres the code i used

global $vbulletin;

$vics = $vbulletin->db->query_read("SELECT username,beat,cscore,oscore FROM" . TABLE_PREFIX ." dbh_victims WHERE username = '" .$post[username]. "' ORDER BY beat ASC");


while ($get = $db->fetch_array($vics))
{
eval('$vicbits .= "' . fetch_template('dbh_victim_bits') . '";');

}

--------------- Added 1270920477 at 1270920477 ---------------

stupid me.. got it to work with $vbulletin->db->fetch_array

thanks for your help