1
My Query
$sql = "SELECT * FROM tablename WHERE algumvalor=2 LIMIT 1";
It’s going into infinite loop here
How do I use while
?
while($row_data=$conn->executaQuery($sql))
{
var_dump($row_data);
}
With for
works
$row_data = $conn->executaQuery($sql);
foreach($row_data AS $dados){
var_dump($dados);
}
Connection and search class
public function executaQuery($sql){
$db = $this->conn;
$sth = $db->prepare($sql);
$sth->execute();
return $sth->fetch(PDO::FETCH_ASSOC);
}
Your query always returns the same line.
– rray