Weird error

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
influx
Forum Commoner
Posts: 31
Joined: Fri Aug 05, 2005 9:28 am

Weird error

Post by influx »

Code: Select all

function email_checker($tess)
{
   $name_check = $db_object->query("SELECT m_email FROM mail_list WHERE m_username = '{$_SESSION['username']}' AND m_email = '$tess'");
   $name_checkk = $name_check->numRows();
   if ($name_checkk != 0) //if number of rows isn't 0, there obviously is already a row with that same username
   {
       return false;
   }
}
What could be wrong with this code? I get the following error:

Fatal error: Call to a member function on a non-object in /var/www/website.com/test.php on line 206 (the first line in the function after the opening { bracket)
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

Post by neophyte »

Insert after function blah($tes):

Code: Select all

global $db_object;
That should do it.
Post Reply