Posted 06 September 2006 - 02:10 PM
I would like to display a percentage of a query on my query results page i.e. display the table of results and then down at the bottom, a line saying "The total percentage is *%", but have no idea how to?? I am using a MySQL database. Any ideas??
Posted 06 September 2006 - 02:13 PM
Or are you asking how to show the percentage sign?
Posted 06 September 2006 - 02:20 PM
I'm asking how to work out the percentage and display the result
Posted 06 September 2006 - 02:24 PM
I don't know pagination yet, I like creating my own stuff. so I haven't came up with something yet, but I have to admit, if that's what you mean the idea is amazing, if you get something started, I will be happy to help you work it out, if I can remember htis post, I really like that idea, and would like to help you make it happen, you mean instead of display 4 pages of search results, show like 25% for each page, and adjust that basedon the search results, I love the idea, I know it's possible too.
Business Website: http://www.infotechnologist.biz
Personal Website: http://www.joyelpuryear.com
Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.
Posted 06 September 2006 - 02:50 PM
The following works out the number of entries on the current page as a percentage of the total number of entries and displays it.
<?php $total_entries = mysql_num_rows(........); entries_this_screen = 20; $percent = round($entries_this_screen * 100 / $total_entries); echo "This page shows $percent% of the total result"; ?>
Posted 06 September 2006 - 02:54 PM
For example, when I run a query searching for users who's internet has been filtered, I would like to display a table with the users name & address (have already done this) and at the bottom, display the total percentage of users that has their internet filtered. Does this make any more sense?
Posted 06 September 2006 - 03:01 PM
queryA -> SELECT COUNT(*) FROM users; queryB -> SELECT userid FROM users WHERE filtered = 'ON' $total_filter = mysql_num_rows(queryB); $percent = round($total_filter * 100 / result_queryA); echo "This is $percent% of the total number of users";
Posted 06 September 2006 - 03:02 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users