PDA

View Full Version : Own query in fuction


PanterSi
10-28-2009, 07:04 AM
I have integrated page and want my own query execute in own function. Is there any similar to query_read_slave, because unfortunately this not work to call from function (Fatal error: Call to a member function query_read_slave() on a non-object).

Regards

--------------- Added 1256719513 at 1256719513 ---------------

I solve a problem.
Instead of
$thread = $db->query_read_slave($strSQL);
while ($row = $db->fetch_array($thread))
...
I used
$thread = mysql_query($strSQL);
while ($row = mysql_fetch_array($thread))


Any one know what is the main difference?

Lynne
10-28-2009, 03:22 PM
$db->whatever is a method defined by vbulletin. Unless you include global.php or init.php in your files, you cannot use that method - you will get the error you got.

PanterSi
10-29-2009, 07:31 AM
$thread = mysql_query($strSQL); give me the correct result, even if I didnt declare connection. Is connection inhereted from vb?

Lynne
10-29-2009, 04:03 PM
I believe so, yes.