ho uno script con due classi dove c e una funzione
if ($this->dbCon->numRows()== 1)
che di da sempre zero come risultato e sto diventando pazzo perche non riesco a capire il perche
lo script completo é:
classe 1
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();
$this->dbCon->storeResult();
$password = hash('sha512', $password . $salt);
var_dump($this->dbCon->numRows()== 1);
if ($this->dbCon->numRows()== 1)
classe2
// inizzio metodi statement
public function preparestatement($statement){
$this->_statement = $this->_dbCon->prepare($statement);
}
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();
}
}
grazie per l aiuto