Log in

View Full Version : Small query-question


Gerdoso
02-05-2002, 04:12 PM
How can i add a sql-query right into a function like
function show($userinfo) in online.php ?

E.g.:

*** $result=$DB_site->query_first("SELECT title FROM forum WHERE forumid=6");

should work, but brings up this error:

*** Call to a member function on a non-object in .../vbulletin/online.php on line 58

It works if i add it outside of the functions, but doesn't inside of one.

Any idea ?

Admin
02-05-2002, 06:46 PM
Globalize $DB_site in the show() function.

But I wouldn't do this if I were you because you will basically execute that query every time the function is called, that is once per member online = lots of queries. :)

Gerdoso
02-05-2002, 07:18 PM
Thanks!
Yeah, you're right - and i just found a solution to not include this in a function ...