Hmmm, just wondering, why are you running your query twice ?
You run it once, and extract the username from every rows in it. But in the while() loop, you run it again.
It's useless, remove the second mysql_query().
Appart from that, you totally mixed thing inside and outside the loop, and you where closing a block that was never opened (the last } )
Try this code:
PHP Code:
<?php //connect to database $conn = mysql_connect("localhost", "something", "something") or die(mysql_error()); mysql_select_db("something",$conn) or die(mysql_error()); //create the sql statement $sql = "select * from highscores where userid = $_GET[userid]"; //execute the sql statement $result = mysql_query($sql, $conn) or die(mysql_error()); //go through each row in result set and display data /* tripy First, output your header */ echo " Your scores are as follows:<br><table width=200 border=1> <tr> <td>Score</td> </tr> "; /* tripy now parse the results... */ while ($newArray = mysql_fetch_array($result)) { $userid = $newArray['userid']; $score = $newArray['score']; echo " <tr> <td>$score</td> </tr>"; } /* tripy And finally, close your table. */ echo "</table>"; ?>
__________________
Listen to the ducky: "This is awesome!!!"
|