marek_mar
05-11-2004, 03:53 PM
I don't know how to put it but I get the error even if I did everything right (some peple said it solved their problem)
The code:// Connect to database.
$db = ADONewConnection($db_type);
$db -> debug = 0;
$db -> Connect($db_host, $db_user, $db_pass, $db_name);
class session
{
function start()
{
global $db;
$rs = $db->Execute("SELECT * FROM sessions");
$session_data = $rs->FetchRow();
}
}
At first I didn't make $db global. I got the "Call to a member function on a non-object" error. After reading some forums I found out that it has to be global (there was even an examle with ADoDB. It worked for them but not for me). That should have solved the problem but it didn't. Why won't it work? Please help!
Thank you!
The code:// Connect to database.
$db = ADONewConnection($db_type);
$db -> debug = 0;
$db -> Connect($db_host, $db_user, $db_pass, $db_name);
class session
{
function start()
{
global $db;
$rs = $db->Execute("SELECT * FROM sessions");
$session_data = $rs->FetchRow();
}
}
At first I didn't make $db global. I got the "Call to a member function on a non-object" error. After reading some forums I found out that it has to be global (there was even an examle with ADoDB. It worked for them but not for me). That should have solved the problem but it didn't. Why won't it work? Please help!
Thank you!