PHP rounding function not working for rounding up
<p>For the code below, sometimes the value <strong>$endorsepoints</strong> is not a whole number.  I want it to be rounded off, up or down, depending on normal math rules.  </p>

<p>Then, I want to input the rounded number into two MySQL tables, <strong>comment</strong> and <strong>submission</strong>.  </p>

<p>I want the number rounded up or down per normal math rules.</p>

<p>When the number is supposed to be rounded down (i. e. 5203.25), the correct rounded number (i. e. 5203.00) gets added to both <strong>comment</strong> and <strong>submission</strong>.</p>

<p>When the number is supposed to be rounded up (i. e. 5151.74), the correct rounded number (i. e. 5152.00) gets added to <strong>submission</strong>.  However, in this situation, the rounded down number (i. e. 5151.00) is added to <strong>comment</strong>.  How can I make the rounded up number go into <strong>comment</strong> in this situation?</p>

<pre><code>   $endorsepoints = $endorsepoints * .01;

    $endorsepoints2 = ( $endorsepoints &lt;= 10 ) ? 10 : $endorsepoints;

    $endorsepoints2 = round($endorsepoints2);





    $query1 = sprintf("INSERT INTO comment VALUES (NULL, %d, %d, '%s', %d, NULL)", $uid, $submissionid, $comment, $endorsepoints2);

    mysql_query($query1) or die(mysql_error());


    $query2 = sprintf("UPDATE submission SET points = (points + '$endorsepoints2') WHERE submissionid = '$submissionid'");

    mysql_query($query2) or die(mysql_error());
</code></pre>

<p>EDIT:  I want the same number inserted into both tables at all times.  My question is: why is it not?</p>
