Debe usar fetchColumn()
$count = $db->query("SELECT COUNT(id) FROM users");
debería ser
$count = $db->query("SELECT COUNT(id) FROM users")->fetchColumn();
echo $count; //Returns number of rows
Debe usar fetchColumn()
$count = $db->query("SELECT COUNT(id) FROM users");
debería ser
$count = $db->query("SELECT COUNT(id) FROM users")->fetchColumn();
echo $count; //Returns number of rows