Answer the question
In order to leave comments, you need to log in
Unable to retrieve data from php database, what could be the problem?
Hello. Since once I say I'm a bad programmer.
I had such a problem when I want to display data from the database in this way, then everything works:
$res=$this->db->mysqli->query('SELECT * FROM user) or die (mysql_error());
$data = array();
while(($row=$res->fetch_assoc())!=false){
$data[]=$row;
}
echo $data; //Получаю массив
$email='[email protected]';
$res=$this->db->mysqli->query('SELECT * FROM user WHERE email='.$email);
$data = array();
while(($row=$res->fetch_assoc())!=false){//ОШИБКА
$data[]=$row;
}
echo $data;
Answer the question
In order to leave comments, you need to log in
email string, and strings are quoted
$res=$this->db->mysqli->query("SELECT * FROM user WHERE email='".mysql_real_escape_string($email)."'");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question