Jump to content

Sorting an upvoting system


activee

Recommended Posts

Hey I'm trying to do an up voting system kinda like reddit. So I got my table with upvotes and downvotes.

The hiccup is when i want to echo all the entries in my table but I want these being sorted by effective votes. 

 

So basically if an entry has 250 upvotes and 30 downvotes and the second entry has  250 upvotes and 2 downvotes the second one should be echoed first. I know how to echo all the rows of my table I just don't know how to sort them via effectives votes.

I'm not sure how I should proceed. Any help to get started  would be welcome.

Link to comment
https://forums.phpfreaks.com/topic/288623-sorting-an-upvoting-system/
Share on other sites

no, no no

I got upvotes in my table and I got downvotes in my table.
I don't have effectivevotes in my table. effectivevotes = upvotes - downvotes. I want my rows to be ordered by effectivevotes.

 

if I follow your instruction if I'm not mistaking : one row could have 1000 upvotes and 2000 downvotes and would still be higher than a row which has 1 upvotes and 0 downvotes

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.