Hi ya. I've made something like this for some1 recently. This piece of php code will deffinitely help you:
PHP Code:
<?php
//just replace the 'host', 'user', 'pass', and 'db' with stuff you have
$connect = @mysql_connect('host','user','pass');
$dbselect = @mysql_select_db('db',$connect);
$query = @mysql_query('SELECT player, score FROM scores ORDER BY score DESC LIMIT 10');
if (!$connect or !$dbselect or !$query) {
exit('failed=true');
}
$num = 1;
$rows = mysql_num_rows($query);
while ($info = mysql_fetch_assoc($query)) {
$key = array_keys($info);
echo($key[0].''.$num.'='.$info['player'].''.($num <= $rows ? '&' : '').''.$key[1].''.$num.'='.$info['score'].($num < $rows ? '&' : ''));
$num++;
}
mysql_free_result($query);
mysql_close($connect);
?>
PS: that code assumes you have a table in your database called "scores" and in it there should be columns "player" and "scores".
note: it will return variables in this layout:
"player"a increasing number"="name of player"&score"a increasing value equivlent to the one before"="score value
so: if there is a table in MySQL like this:
Code:
+-------+------+
|player | score |
+-------+------+
| foo | 100 |
+-------+------+
| bar | 250 |
+-------+------+
| var | 90 |
+-------+------+
this will be returned by the PHP code:
player1=bar&score1=250&player2=foo&score2=100&play er3=var&score3=90
Hope that helps
J.W_(Dark_Element)
<C-Stamp> if you need more help you are welcomed to PM me </C-Stamp>