Member Object Problem
Posted: Sun Jun 19, 2005 12:21 pm
Well in my script i got a class that has functions in it which im able to call. Im using the punbb methods of doing it.
First of all I make connect.php which declares a connection method:
then iv got a methods.php which uses that connection method to run queries, such as the example below:
This is the code that uses the query:
but when i run the script it shows an error of the member object called for a non object:
Thanks in advance if anyone could help
First of all I make connect.php which declares a connection method:
Code: Select all
<?php
include 'mysql.php';
$db = new DBLayer('localhost', 'user', 'pass', 'db', '', false);
?>Code: Select all
<?php
require 'connect.php';
function check_cookie()
{
$c = $db->query('SELECT * FROM users');
$f = $db->fetch_assoc($c);
if(isset($_COOKIE["rscheetah_cookie_temp"]))
{
list($cookie['username'], $cookie['password']) = unserialize(stripslashes($_COOKIE["rscheetah_cookie_temp"]));
$username = strtolower($cookie['username']);
$password = strtolower($cookie['password']);
if(strtolower($f['username']) == $username && strtolower($f['password']) == $password)
{
return true;
}
else
{
return false;
}
}
elseif(isset($_COOKIE["rscheetah_cookie_perm"]))
{
list($cookie['username'], $cookie['password']) = unserialize(stripslashes($_COOKIE["rscheetah_cookie_perm"]));
$user = strtolower($cookie['username']);
$pass = strtolower($cookie['password']);
if(strtolower($f['username']) == $user && strtolower($f['password']) == $pass)
{
return true;
}
else
{
return false;
}
}
else
return false;
}
?>Code: Select all
$c = $db->query('SELECT * FROM users');
$f = $db->fetch_assoc($c);Code: Select all
Fatal error: Call to a member function on a non-object in /home/rsneebn/public_html/methods.php on line 7