title: Show 2 decimal places without rounding off
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1992406/how-do-i-format-numbers-to-have-only-two-decimal-places">How do I format numbers to have only two decimal places?</a>  </p>
  </blockquote>
  
  
  
  <p>I have looked all over for a solution. Say i have a variable with a number like this:</p>
  
  <pre><code>$price1 = 1597;
  $price2 = 1497.85;
  </code></pre>
  
  <p>Is there a function that displays 2 decimal places without rounding off when there is a even number:</p>
  
  <pre><code>$price1 = 1597.00;
  $price2 = 1497.85;
  </code></pre>
  
  <p>UPDATE:</p>
  
  <p><strong>I have found the problem, the SUM(total) MySQL function rounds off the value:</strong></p>
  
  <pre><code>          $result = mysql_query("SELECT SUM(total), SUM(subtotal) FROM jos_vm_order_list WHERE user_id = '$user_id'");
  
  while($totalrow = mysql_fetch_array($result))
    {
  
  
  
      $total = $row['SUM(total)'];
      $total = number_format($total, 2, '.', '');
      $subtotal = $row['SUM(subtotal)'];
      $subtotal = number_format($subtotal, 2, '.', '');
  
    }
  </code></pre>
  
  <p><strong>Is there anyway it can not round off while using the MySQL SUM() function?</strong></p>
  
  <p>Thank you for the help in advance.</p>