I'm having an issue with using $stmt->num_rows in PHP and I'm not sure what I'm doing wrong. $stmt->num_rows is returning 0 when it should be returning 1. The query does work and returns 1 result when executing it in phpMyAdmin. Any help would be greatly appreciated.
class usermodel { public function login($email, $password) { $query = "SELECT * FROM members WHERE email=? LIMIT 1"; $this->dbCon->preparestatement($query); $param_type = "s"; $params = array_merge(array($param_type), $email); $tmpArray = array(); foreach ($params as $i => $value) { $tmpArray[$i] = &$params[$i]; } $this->dbCon->bindParamsToStatement($tmpArray); $this->dbCon->execStartement(); $this->dbCon->storeResult(); $user_id = 0; $username = ''; $db_password = ''; $salt = ''; $email = ''; $this->dbCon->bindResult(array(&$user_id, &$username, &$email, &$db_password, &$salt)); $this->dbCon->fetchStartement(); $password = hash('sha512', $password . $salt); if ($this->dbCon->numRows()== 1) { class 2: // start statement public function preparestatement($statement){`enter code here` $this->_statement = $this->_dbCon->prepare($statement);`enter code here` } public function bindParamsToStatement($params ){ call_user_func_array( array( $this->_statement, 'bind_param' ), $params ); } public function execStartement(){ return $this->_statement->execute(); } public function storeResult(){ $this->_statement->store_result(); } public function bindResult($params){ call_user_func_array( array( $this->_statement, 'bind_result' ), $params ); } public function fetchStartement(){ return $this->_statement->fetch(); } public function numRows(){ $this->_statement->num_rows; } public function closestartement(){ $this->_dbCon->close(); }