Posts: 175
Location: Wiltshire, England
|
Hi again lothop,
This one caused me to scratch my head a bit, but I think I've sussed it!
We (well me actually) have set the query to end as: -
ORDER BY rank DESC
Well this won't work, because the field in the database table that deals with the rank is actually called level_id
Try this as your query: -
PHP Code:
$sqlquery = "SELECT username,level_id,age,bot,country,gender FROM users ORDER BY level_id DESC";
Also, I always connect to the database using this method: -
PHP Code:
//define database variables
$host = "localhost";
$user = "";
$pass ="";
$dbname = "mydbname";
//connect to db
$link = mysql_connect($host, $user, $pass)
or die("Could not connect : " . mysql_error());
And code my queries results like this:
PHP Code:
$result = mysql_db_query($dbname, $sqlquery, $link) or die("Query failed : " . mysql_error());
I hardly ever get any problems unless I've got the syntax wrong like missing out a ; somewhere and if I do, the or die statement gives me a good idea where to start looking for the problem.
Hope this helps.
Ian.
|