Page 1 of 1

any ideas

Posted: Mon Oct 19, 2009 5:34 am
by gotornot
I previously had a coder work for me now im learning myself the only trouble is some code he did is going wrong and he never made any comments on his work so i cant find out why the error is occuring

Here is the code
function ad_status($id)
{
$id = (int)$id;

$q = 'SELECT status FROM advert WHERE id = '.$id;
$this->db->safe_query($q, __FUNCTION__, __LINE__);

if (!$this->db->num_rows())
{
return ADCON_STATUS_ABSENT;
}

$status = $this->db->result();

if ($status == 1)
{
return ADCON_STATUS_ACTIVE;
}

return ADCON_STATUS_SUSPENDED;
}

This is the error it chucks up:
Call to a member function on a non-object

Can anyone else point me in the right direction?

Re: any ideas

Posted: Mon Oct 19, 2009 8:03 am
by JNettles
This function is apparently part of a larger class and you're trying to call it outside the realm of the function.