Vous devez utiliser fetchColumn()
$count = $db->query("SELECT COUNT(id) FROM users");
Devrait être
$count = $db->query("SELECT COUNT(id) FROM users")->fetchColumn();
echo $count; //Returns number of rows
Vous devez utiliser fetchColumn()
$count = $db->query("SELECT COUNT(id) FROM users");
Devrait être
$count = $db->query("SELECT COUNT(id) FROM users")->fetchColumn();
echo $count; //Returns number of rows