Você deve usar
fetchColumn()
$count = $db->query("SELECT COUNT(id) FROM users");
Deveria estar
$count = $db->query("SELECT COUNT(id) FROM users")->fetchColumn();
echo $count; //Returns number of rows
fetchColumn()
$count = $db->query("SELECT COUNT(id) FROM users");
$count = $db->query("SELECT COUNT(id) FROM users")->fetchColumn();
echo $count; //Returns number of rows