[snip] Sorry, Jay, but that's a horrible method. You could just run one query with a GROUP BY clause to get the sum for each invoiceID, instead of running multiple queries like you've mentioned...
$query = "SELECT invoiceid, SUM(partpaidamount) AS partpaid FROM $tb_name GROUP BY invoiceid"; $rs = mysql_query($query) or die(mysql_error()); while($r = mysql_fetch_assoc($rs)) { echo "Invoice: {$r['invoiceid']}, SUM: {$r['partpaid']}"; } ---John Holmes... PS: Sorry for the top post, but I'm at work and outlook express sucks. :) [/snip] No problem bro'. I knew it was the long way around I was trying to understand if that was what Ben wanted. And I am so old school that almost always avoid ternary! :) And I feel for you....Express...blech! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php