Im making an affiliate program script and I need to take the total commission earned and divide by the number of clicks to find the EPC (earnings per click).

The problem is $EPC prints $0.33333333333333 ($1.00 earnings / 3 clicks)

My question is: How can I make the 'AS epc' in the query a decimal(5,2) so it will print just $0.33

PHP Code:

"SELECT sum(totalcomm), sum(click), (sum(totalcomm) / sum(click)) AS epc FROM transactions where OFID = $row[OFID] AND AFID = '{$_REQUEST['AFID']}' Group BY AFID ";

$resultEPC mysql_query($sqlEPC$conn);   
if (!
$resultEPC) { 
"<p>Error performing query: " mysql_error() . "</p>"); 
  exit(); } else {

while (
$EPCrow mysql_fetch_array($resultEPCMYSQL_ASSOC)) { 
$EPC $EPCrow[epc];
//end while
}//end else