Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

LEADERBOARDS

Featured Replies

Hello

 

I am trying to create a leaderboard for a website that will display rank name and points of 50 people in the specific database an when updated people will be arranged assending in points that will change as updates occur. I have no idea of how to go about doing this, I know you can use PHP and MySQL to do it and I have looked all over the web for basic tutorials but have found nothing, If anyone could show me a beginners guide to creating such a thing it would help me out loads! I have hardly any knowledge on PHP or MySQL so any kind of advice would be greatful. Is there any scripts out there I can use just to create a simple 3 column table or is it more complex than what I think? also once I have created this leaderboard would it be possible to display a smaller version of it on a different page containing only the top 10 people? Somebody please help me It would be really helpful also can make some kind of payment to someone who can run me through the whole thing..

 

Cheers

  • Author

Okay, so no one decided to help me so I found out some information for myself, I have managed to build a database and display it using PHP. Now I wish to know how I can arrange this table in order of points highest to lowest, here Is the code I have.

 

<?php

$connect = mysql_connect("localhost","root","");

if(!$connect){
die("Failed to connect: " . mysql_error());
}

if(!mysql_select_db("testRS")) {
die("Failed to select DB:" . mysql_error());
}

$results = mysql_query("SELECT * FROM testtable");

while($row = mysql_fetch_array($results)){
echo $row['ID'] . " ";
echo $row['Name'] . " ";
echo $row['Points'] . "<br/><br/>";
}





?>

Edited by Renaissance-Design
Please use the code button or tags to format your code.

Patience is a virtue.

You waited an hour an hour and a half at a time when most people are at work, this forum may be busy but you still have to wait for someone to have a look. It's not a case of "No one decided to help me".

  • Author

Patience is a virtue.

You waited an hour an hour and a half at a time when most people are at work, this forum may be busy but you still have to wait for someone to have a look. It's not a case of "No one decided to help me".

I was getting stressed as I couldnt find the solution anywere, eventually I figured it out for myself, I figured this was quite a busy forum so thought I would get the response pretty quick seeing as there were over 20 views at the time.

 

change your select statement to

$results = mysql_query("SELECT * FROM testtable ORDER BY Points DESC");

 

Thank you, that is what I figured would work after a little research, maybe you could help me with my next step, how would I go about having a mini leaderboard that would display the top 10 results of the original 50 man leaderboard?

$results = mysql_query("SELECT * FROM testtable ORDER BY Points DESC LIMIT 10");

 

Imagine what you will know tomorrow...

 

Remember few problems you encounter will be unique, thousands will have asked the same questions before you and all the answers are out there scattered across the Internet in forums, blogs & tutorials waiting to be found.

  • Author

$results = mysql_query("SELECT * FROM testtable ORDER BY Points DESC LIMIT 10");

 

Imagine what you will know tomorrow...

 

Remember few problems you encounter will be unique, thousands will have asked the same questions before you and all the answers are out there scattered across the Internet in forums, blogs & tutorials waiting to be found.

 

 

Yeh I understand that but when I have no knowledge of what I am actually looking or its hard to pick out the parts that will actually benefit me, therefore I need someone to help me! Thanks though that truly helps

Ah well.. the problem is that ALL of it will be usefull at some stage and what there is already can change every few years. So you are not alone for we are all somewhere on that steep learning curve picking the brains of others who have explored different routes.

 

Many of the full-time freelancers here including myself will testify that 'Murphys Law' of web design does exist and you can pretty much guarantee a client will ask you to do something you have never coded before.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.