Here is my query:

<?
$result = mysql_query("SELECT SUM(amount) AS stuff FROM transactions"); 
$row = mysql_fetch_array( $result );
echo "amount: ".$row['stuff'];
?>

My result is kinda long: amount: 54.67854333

How do I round up so it only produces: 54.67, or maybe 54.68 ?

    You could also do it in the query itself:

    $result = mysql_query("SELECT ROUND(SUM(amount), 2) AS stuff FROM transactions");
    
      Write a Reply...