PDA

View Full Version : Call to a member function query_read() on a non-object in


abdicar
02-05-2010, 05:22 PM
Hi there to everybody :)

I'm testing in the widgets to insert our custom php code in vb4.

I have this:

$results = $db->query_read("SELECT *
FROM user LIMIT 0 , 1);

And I got something like this:

Fatal error: Call to a member function query_read() on a non-object in /home/admin/domains/.../packages/vbcms/widget/execphp.php(171) : eval()'d code on line 2

Do you have any suggestion to connect from a widget with direct php exc to check the database?

thank you!

Lynne
02-05-2010, 05:33 PM
You really should take a look at some of the widgets already released here to see how they went about this. You need to make a query like so:
$results = vB::$db->query_read("stuff.....

abdicar
02-05-2010, 07:47 PM
Yes, but i tried to search widgets here and i can't found any :(

Paul M
02-05-2010, 08:26 PM
Actually you can just do what you would do in any function. Globalise $vbulletin, and use it in all database calls instead of $db ;


globalise $vbulletin;

$results = $vbulletin->db->query_read("stuff.....



Yes, but i tried to search widgets here and i can't found any :(
Your not looking very hard, there are plenty.

abdicar
02-05-2010, 08:51 PM
Thank you for your reply guys. I just get it. Thank you and have a great weekend.... beer time!