Jump to content

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


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
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...