djfox Posted September 20, 2007 Share Posted September 20, 2007 I have the following codes: <?php $total = $rows[8] + $rows[9] + $rows[10] + $rows[11] + $rows[12] ; $per1 = $rows[8]/$total ; $per2 = $rows[9]/$total ; $per3 = $rows[10]/$total ; $per4 = $rows[11]/$total ; $per5 = $rows[12]/$total ; if (isset($_GET['results']) && $_GET['results'] == "view") { echo "<b>Results:</b>"; echo "<br>$rows[3] <b>$rows[8]</b><br><font size=2>$per1 %</font>"; echo "<br>$rows[4] <b>$rows[9]</b><br><font size=2>$per2 %</font>"; echo "<br>$rows[5] <b>$rows[10]</b><br><font size=2>$per3 %</font>"; echo "<br>$rows[6] <b>$rows[11]</b><br><font size=2>$per4 %</font>"; echo "<br>$rows[7] <b>$rows[12]</b><br><font size=2>$per5 %</font>"; echo "<p>$total Votes"; } ?> How can I convert the $per values to display as percentages? Currently they display as 0.5 and so on. Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted September 20, 2007 Share Posted September 20, 2007 multiply by 100 and add a % sign... Quote Link to comment Share on other sites More sharing options...
djfox Posted September 20, 2007 Author Share Posted September 20, 2007 Thanks very much. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.