Jump to content

Array help


paulman888888

Recommended Posts

<?php
// Make a MySQL Connection
mysql_connect("localhost", "admin", "1admin") or die(mysql_error());
mysql_select_db("test") or die('Theres an error.');

// Get all the data from the "example" table
$result = mysql_query("SELECT * FROM example") 
or die('Theres an error.');  

echo "<table border='1'>";
echo "<tr> <th>Name</th> <th>Score</th> </tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo "<tr><td>"; 
echo $row['name'];
echo "</td><td>"; 
echo $row['score'];
echo "</td></tr>"; 
} 

echo "</table>";
?>

This is the code i am useing.

I would like it to be arrached so that the highest score is at the top and lowest score is at the bottom. How could I do that?

Please help.

 

Thankyou

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.