Vel Posted August 5, 2011 Share Posted August 5, 2011 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? Quote Link to comment https://forums.phpfreaks.com/topic/243986-cycle-through-5-users-information/ Share on other sites More sharing options...
phpSensei Posted August 5, 2011 Share Posted August 5, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/243986-cycle-through-5-users-information/#findComment-1252899 Share on other sites More sharing options...
Vel Posted August 5, 2011 Author Share Posted August 5, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/243986-cycle-through-5-users-information/#findComment-1252905 Share on other sites More sharing options...
phpSensei Posted August 5, 2011 Share Posted August 5, 2011 You had it right the first time, its done through Ajax or Jquery. Quote Link to comment https://forums.phpfreaks.com/topic/243986-cycle-through-5-users-information/#findComment-1252921 Share on other sites More sharing options...
Vel Posted August 5, 2011 Author Share Posted August 5, 2011 OK. Thanks for the information . Quote Link to comment https://forums.phpfreaks.com/topic/243986-cycle-through-5-users-information/#findComment-1252924 Share on other sites More sharing options...
phpSensei Posted August 6, 2011 Share Posted August 6, 2011 Np, you can mark topic as solved, if you have further questions post it here or make a new thread in the Ajax Section Quote Link to comment https://forums.phpfreaks.com/topic/243986-cycle-through-5-users-information/#findComment-1252926 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.