I have the following table
AffID l Commision
-------------------------
MW001 5
MW004 10
MW001 25
MW001 5
MW004 5
I want to submit a query that counts the amount in a column. So for example the output i am looking for is :
MW001 - 35
The query i am using now does not working correctly, it counts the actual amount of records.
$sql = "SELECT COUNT(*) as c FROM toutcome WHERE affID = '" . $_SESSION['affID'] . "'";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
echo $row['c'] ;