I started using PDO recently, earlier I was using just MySQL.
Now I am trying to get all data from database.
$getUsers = $DBH->prepare("SELECT * FROM users ORDER BY id ASC");
$getUsers->fetchAll();
if(count($getUsers) > 0){
while($user = $getUsers->fetch()){
echo $user['username']."<br/>";
}
}else{
error('No users.');
}
But it is not showing any users, just a blank page.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…