SA-MP Forums Archive
[PHP/MYSQL] Help needed - 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)
+--- Thread: [PHP/MYSQL] Help needed (/showthread.php?tid=549427)



[PHP/MYSQL] Help needed - MD5 - 06.12.2014

Hello,

I currently have an intention to make a leaderboard displaying the 'top 10 players' that includes (Score, Kills, Deaths) could anyone help by posting an example of what the mysql query should look like?

Regards,
MD5


Re: [PHP/MYSQL] Help needed - CoaPsyFactor - 06.12.2014

SELECT `score`, `kills`, `Deaths` FROM `players` LIMIT 10 ORDER BY `id` DESC;


Re: [PHP/MYSQL] Help needed - MD5 - 06.12.2014

Now, what goes below it: $blahb = blab($query); ?

Thanks!


Re: [PHP/MYSQL] Help needed - Vince - 06.12.2014

Check examples on php.net. Your best source of information: http://be2.php.net/manual/en/mysqli.query.php

Don't use the "mysql" module anymore since it's deprecated. Either use mysqli (linked above) or PDO.


Re: [PHP/MYSQL] Help needed - MD5 - 06.12.2014

So like?

Код:
mysqli_query("SELECT `score`, `kills`, `Deaths` FROM `players` LIMIT 10 ORDER BY `id` DESC", MYSQLI_USE_RESULT);

$results = mysqli_free_result($result);