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