Du bör använda fetchColumn()
$count = $db->query("SELECT COUNT(id) FROM users");
Borde vara
$count = $db->query("SELECT COUNT(id) FROM users")->fetchColumn();
echo $count; //Returns number of rows
Du bör använda fetchColumn()
$count = $db->query("SELECT COUNT(id) FROM users");
Borde vara
$count = $db->query("SELECT COUNT(id) FROM users")->fetchColumn();
echo $count; //Returns number of rows