Jump to content

Cycle through 5 users information


Vel

Recommended Posts

Hey guys, I'm not sure where to start with this one so I thought it would be best if I explain what I want to achieve and then hopefully you awesome guys can point me in the right direction for getting it done.

 

I have a table with users. I have another table with ratings and comments for users. What I want to do is pick the top 5 rated users, a random comment, and then display them sequentially one at a time on my website. I have a box on the right hand side of the website in which the top rated user's details would be displayed, along with the random comment. After x number of seconds it would fade to another user. Once it gets back to the first user I would like it to load another random comment using Ajax.

 

How would I go about this?

Link to comment
https://forums.phpfreaks.com/topic/243986-cycle-through-5-users-information/
Share on other sites

This would be a good question for KickStart,

 

however its quite an easy process which you can do completely in SQL.

 

I'll provide some resources for you:

http://www.sql-tutorial.net/SQL-JOIN.asp - Using Join can take two tables and merge them based on common columns. Hence merge your Users and Comments based on the USER ID, then do a RAND on the comment's ID with a LIMIT of 5.

 

 

That's helpful, thank you :). That covers getting the information I need out of the database nicely.

 

However I'm also unsure what would be the best way to get the details displayed on a page to cycle every x seconds. I've seen it done on other websites but I have no idea how they do it, and no idea what to type in google to get a good guide to teach me how to do it.

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.