$sql=mysql_query("SELECT client_id FROM invoices WHERE amount >'$amount' ");
$data = mysql_fetch_array($sql);
$counts = array_count_values($data['client_id']);
if (isset($counts['drew010'])) {
echo $counts['drew010'];
} else {
echo "0";
}
that should do what you want it to do. the client_id will become an array index in $counts and it will hold the number of times the client id shows up in the resultset. so if i bought things 5 times from you over that $amount, echo $counts['drew010'] would print out 5.