Jump to content
Sign in to follow this  

Create Ranking

Recommended Posts


Hello everyone,

I would like to create a ranking of pilots according to the pay, but unfortunately, I have a problem of coding. If anyone would have an idea about the solution it would be cool.

I want to use the $pilots table and collect the id and totalpay Here is my code and my bug below.

$reponse = mysql_query('SELECT * FROM pilotid ORDER BY totalpay');
$rang = 0;
while ($pilots = mysql_fetch_array($reponse))
echo $rang;
echo $pilots['pilotid'];
echo $pilots['totalpay'];

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/dahvirtumu/smart/core/templates/toppilot/tp_index.php on line 4

Warning: mysql_connect(): Unknown MySQL server host 'dahvirtumub738' (1) in /home/dahvirtumu/smart/core/templates/toppilot/tp_index.php on line 4

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/dahvirtumu/smart/core/templates/toppilot/tp_index.php on line 13


Thank's for your help


Share this post

Link to post
Share on other sites

Try this

$pilots = DB::get_results("SELECT * FROM ".TABLE_PREFIX."pilots ORDER BY `totalpay` DESC");
$ranking = 0;

foreach($pilots as $p) {
	echo '#'.$ranking.' | '.PilotData::getPilotCode($p->code, $p->pilotid).' - $'.$p->totalpay;
	echo '<br />';



  • Thanks 1

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this