JSHINER Posted February 15, 2008 Share Posted February 15, 2008 <?php class Auth { function _authenticate($db, $username, $password) { if (!ValidText::username($username)) { return false; } if (!ValidText::password($password)) { return false; } return $db->getRow('SELECT * FROM users WHERE username = \'' . $db->escape($username) . '\' AND password = \'' . $db->escape(md5($password)) . '\''); } ?> How come with the above code I get the error: "Fatal error: Call to a member function getRow() on a non-object in /home/..." Quote Link to comment Share on other sites More sharing options...
schilly Posted February 15, 2008 Share Posted February 15, 2008 Can you show us the $db class? Quote Link to comment Share on other sites More sharing options...
JSHINER Posted February 15, 2008 Author Share Posted February 15, 2008 <?php function getRow($query) { $result = $this->query($query); $row = false; if ($result) { $row = mysql_fetch_assoc($result); mysql_free_result($result); } return $row; } ?> Quote Link to comment Share on other sites More sharing options...
JSHINER Posted February 15, 2008 Author Share Posted February 15, 2008 Am I missing something here? I can't figure this one out. I've gone through all of my code and everything seems fine. Quote Link to comment Share on other sites More sharing options...
schilly Posted February 15, 2008 Share Posted February 15, 2008 where is $db declared? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.