SA-MP Forums Archive
php help :< - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: php help :< (/showthread.php?tid=261079)



php help :< - swieberdevos - 11.06.2011

I have mysql for over a month and i would like to create a top 5 players for on my website.

I hope somebody can help me with this.


Re: php help :< - Cyanide - 12.06.2011

You can create something by your description by using the ORDER BY SQL syntax. Here's an example of how it's used if you don't understand the given link.

PHP код:
$order_query = mysql_query( "SELECT * FROM `accounts` ORDER BY `kills` LIMIT 5" );
while(
$order_fetch = mysql_fetch_assoc( $order_query ) )
       echo( 
$order_fetch['username'] . ":" . $order_fetch['kills'] . " kills. <br />" ) ; 



Re: php help :< - [L3th4l] - 12.06.2011

PHP код:
$order_query = mysql_query( "SELECT * FROM `accounts` ORDER BY `kills` DESC LIMIT 5" );
while(
$order_fetch = mysql_fetch_assoc( $order_query ) )
       echo( 
$order_fetch['username'] . ":" . $order_fetch['kills'] . " kills. <br />" ) ; 



Re: php help :< - Cyanide - 12.06.2011

Quote:
Originally Posted by [L3th4l]
Посмотреть сообщение
PHP код:
$order_query = mysql_query( "SELECT * FROM `accounts` ORDER BY `kills` DESC LIMIT 5" );
while(
$order_fetch = mysql_fetch_assoc( $order_query ) )
       echo( 
$order_fetch['username'] . ":" . $order_fetch['kills'] . " kills. <br />" ) ; 
Ah, thank you very much for picking that up. I didn't notice I missed a important keyword in the syntax.