• Welcome to PHPVIBE Forums. Please log in.

[ Video Sharing CMS v4 ] Help Coding a user ranking page

Started by Rafa,

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

RafaTopic starter

I want to have a user ranking page based on total views. For example:
user-A has 3 videos:

  • video 1 - 10 views
  • video 2 - 5 views
  • video 3 - 15 views
  • Total = 30 views

user-B also has 3 videos:

  • video 1 - 1 views
  • video 2 - 5 views
  • video 3 - 10 views
  • Total = 16 views

So, this means user-A is first and user-B is second. This would apply for all video under the user's id. That's the idea. I am thinking:

1. create a sql query (problably INNER JOIN) for the user/video tables;
2. create a loop to go through all videos where the user_id matches in both tables;
3. I will need two variables inside the loop.. one to store the result and another get the new value(then add it with the stored value);
4. Once it when through all videos for user one, store the value in the array variable for all users.
5. Create a final loop aiming to print and order the results in ascending fashion.

How does that sound? I won't be able to get to coding until the weekend, but I would appreciate a few suggestions or shortcuts for me to achieve my desired goal.

Thanks
  •  

PHPVibe A.

Why make it heavy?
Joins are heavy.


select
    sum(views) as total
from vibe_videos where user_id =


will return all the video views for the specific user's videos.

You can run it as an cron and update periodically. Or just update it once and then update the user field created to store the videos views on every insert.

 

Similar topics (7)

Important Announcement: PHPVibe Video Sharing CMS End of Life

Started by Marius P.


Replies: 1
Views: 45252

How to use the PHPVibe user system (internally or externally)

Started by PHPVibe A.


Replies: 0
Views: 10944

Better Idea for PHPVibe v5 Channels page

Started by DeadFish


Replies: 2
Views: 4298

insite ads issue when selecting above/below video player location

Started by georgepanaitescu


Replies: 3
Views: 25692

The problem of video viewing PHPVibe 5.0

Started by Nayn


Replies: 25
Views: 73573

embed video does not work on v5

Started by neospider69


Replies: 6
Views: 55214

Video that I've uploaded needs to have that value in admin to upload

Started by spirog


Replies: 4
Views: 8778