Eggzorcist Posted May 9, 2011 Share Posted May 9, 2011 I'm creating a login that uses PDO statements, however when I try to count how many rows was selected, it gives me an error mentioning its an unidentified property, I always tried rowCount, but it did not work either... Notice: Undefined property: PDOStatement::$num_rows in /Users/JPFoster/Sites/Jaipai.Blog/engine.php on line 50 Here's my class method: public function login($user, $pw){ $user = addslashes($this->user); $pw = md5($pw); $query = "SELECT * FROM `users` WHERE `username` = '".$user."' AND `password` = '".$pw."'"; //set up query $results = $this->pdo->query($query); if ($results->num_rows == 1){ $row = $results->fetch_assoc(); echo "Worked!"; //$this->set_session($row['id'], $row['username'], $row['email']); } else { echo "Your Username and Password did not match"; } //if user + passs match { redirect (member page) and set up sessions // Else ... Retry... } Any help with this will be greatly appreciated! Quote Link to comment Share on other sites More sharing options...
Eggzorcist Posted May 9, 2011 Author Share Posted May 9, 2011 Solved, using fetchColumn() instead. 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.