$getcustomers = $db->query_read("SELECT ispending FROM son_customers"); WHILE ($result = $db->fetch_array($getcustomers)) { if ($result[ispending]) { $totalpending += 1 } else { $totalactive += 1 } }