Okay so setup my script, however when i execute i get this error
Fatal error: Call to a member function fetch_one() on a non-object
I know that the object exists as it is used everywhere around the site
PHP Code:
function psess_write($id, $sess_data) {
global $db;
$data = hb_filterClientData($sess_data);
if ($db->fetch_one("SELECT COUNT(*) FROM sessions WHERE sess_id='$id'") == 0) {
$result = $db->query("INSERT INTO sessions (sess_id, sess_data, sess_updated) VALUES ('$id', '$data', UNIX_TIMESTAMP(NOW()))");
if ($db->affected_rows() == 0) return false;
} else {
$db->query("UPDATE sessions SET sess_data='$data',sess_updated=UNIX_TIMESTAMP(NOW( )) WHERE sess_id='$id'");
}
return true;
}
That is the code i am using, and i know the $db object exists, and i have set it to global but still no luck, have i missed something simple?
Thanks
Marc