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/..." Link to comment https://forums.phpfreaks.com/topic/91279-help-with-an-error/ Share on other sites More sharing options...
schilly Posted February 15, 2008 Share Posted February 15, 2008 Can you show us the $db class? Link to comment https://forums.phpfreaks.com/topic/91279-help-with-an-error/#findComment-467777 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; } ?> Link to comment https://forums.phpfreaks.com/topic/91279-help-with-an-error/#findComment-467782 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. Link to comment https://forums.phpfreaks.com/topic/91279-help-with-an-error/#findComment-467848 Share on other sites More sharing options...
schilly Posted February 15, 2008 Share Posted February 15, 2008 where is $db declared? Link to comment https://forums.phpfreaks.com/topic/91279-help-with-an-error/#findComment-468033 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.