Jump to content

Percentages


markmuir

Recommended Posts

Are you talking about your own variation of pagination, if you are then I really like the idea.
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.
Link to comment
https://forums.phpfreaks.com/topic/19903-percentages/#findComment-87126
Share on other sites

I really don't have a clue what you mean by "the total percentage". Of What?
The following works out the number of entries on the current page as a percentage of the total number of entries and displays it.

[code]<?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";
?>[/code]

Ronald   8)
Link to comment
https://forums.phpfreaks.com/topic/19903-percentages/#findComment-87148
Share on other sites


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?
Link to comment
https://forums.phpfreaks.com/topic/19903-percentages/#findComment-87154
Share on other sites

I have no time to code the mysql stuff, but here is the idea:

[code]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";[/code]

Ronald  8)
Link to comment
https://forums.phpfreaks.com/topic/19903-percentages/#findComment-87158
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.