truCido Posted August 2, 2006 Share Posted August 2, 2006 Basically I know how to create the query in SQL to output the result I want however I'm having problems outputting this onto a PHP page? Basically all I want to do is to put a rank along side each result.[code]SELECT a1.planet, a1.score, COUNT( a2.score ) as rankFROM pa_planet_listing a1, pa_planet_listing a2WHERE a1.score <= a2.scoreOR (a1.score = a2.scoreAND a1.planet = a2.planet)GROUP BY a1.planet, a1.scoreORDER BY a1.score DESC , a1.planet DESC ;[/code] Quote Link to comment Share on other sites More sharing options...
ronverdonk Posted August 2, 2006 Share Posted August 2, 2006 What columns exectly do you want to display? In a HTML table?Ronald 8) Quote Link to comment Share on other sites More sharing options...
truCido Posted August 2, 2006 Author Share Posted August 2, 2006 I want to display Planet in one column, score in another and then rank in another as well, its not the html that I can't do its the presenting the results from the query Quote Link to comment Share on other sites More sharing options...
ryanlwh Posted August 2, 2006 Share Posted August 2, 2006 $row['rank'] will be the rank column, or $row[2] if you use mysql_fetch_row Quote Link to comment Share on other sites More sharing options...
ronverdonk Posted August 2, 2006 Share Posted August 2, 2006 If you fetch your rows with $result = mysql_fetch_row.... thenyou use $result[0] for planet, $result[1] for score and $result[2] for rank.Or you might try to name these fields with the AS in MySql, and you could address them as$result['planet'], $result['score'] and $result['rank'].Ronald 8) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.