3raser Posted March 9, 2012 Share Posted March 9, 2012 I really made a poll system that allows users to voice their opinions within the community. Although the system is nearly complete, I can't seem to get the percentages working. Each option in the poll seems to have the incorrect percentage. I've tried several fixes but can't seem to get anything to work. :/ Current code: http://pastebin.com/dr6Ab1vR Picture of problem: Link to comment https://forums.phpfreaks.com/topic/258569-poll-percentages/ Share on other sites More sharing options...
q11we Posted March 9, 2012 Share Posted March 9, 2012 You might have mistaken while rounding. round(($num_of_results/$total))*100 will either give you 100% or 0%. Instead try using round((100*$num_of_results/$total)) that will give rounded percentage. Link to comment https://forums.phpfreaks.com/topic/258569-poll-percentages/#findComment-1325442 Share on other sites More sharing options...
3raser Posted March 9, 2012 Author Share Posted March 9, 2012 Thank you! That was the problem. Link to comment https://forums.phpfreaks.com/topic/258569-poll-percentages/#findComment-1325681 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.