any ideas

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
gotornot
Forum Commoner
Posts: 54
Joined: Fri Jul 31, 2009 2:30 am

any ideas

Post 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?
User avatar
JNettles
Forum Contributor
Posts: 228
Joined: Mon Oct 05, 2009 4:09 pm

Re: any ideas

Post by JNettles »

This function is apparently part of a larger class and you're trying to call it outside the realm of the function.
Post Reply