[PHP/MYSQL]Displays Rankings

Elite Diviner
Joined
Feb 28, 2007
Messages
446
Reaction score
4
I'm really rusty in PHP , I was wondering if some one could whip up a simple PHP script that grabs the user's from a MSQL table and order's them by Level :) Thanks in advance.
 
I assume u know how to setup php to connect ur db.

PHP:
'SELECT Users FROM Table order by Level desc'

Remember change Users to whatever you want load,
Table to table where you want load,
and Level to match ur table level (like if collum says wLevel change it to wLevel)
 
Example script from ww.php.net/mysql

PHP:
<?php
// Connecting, selecting database
$link = mysql_connect('mysql_host', 'mysql_user', 'mysql_password')
    or die('Could not connect: ' . mysql_error());
echo 'Connected successfully';
mysql_select_db('my_database') or die('Could not select database');

// Performing SQL query
$query = 'SELECT * FROM my_table';
$result = mysql_query($query) or die('Query failed: ' . mysql_error());

// Printing results in HTML
echo "<table>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
    echo "\t<tr>\n";
    foreach ($line as $col_value) {
        echo "\t\t<td>$col_value</td>\n";
    }
    echo "\t</tr>\n";
}
echo "</table>\n";

// Free resultset
mysql_free_result($result);

// Closing connection
mysql_close($link);
?>
 
Back