Jump to content

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.

Edited by activee
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

Edited by activee
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.