My Query
$sql = "SELECT * FROM tablename WHERE algumvalor=2 LIMIT 1";
You are entering an 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 class and search
public function executaQuery($sql){
$db = $this->conn;
$sth = $db->prepare($sql);
$sth->execute();
return $sth->fetch(PDO::FETCH_ASSOC);
}