View Single Post
Old 06-11-2002, 11:10 PM   #11 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,529
sde is on a distinguished road
<?
// display_racers.php

// connect to your db
include("connect.php");

// get select information from db and order by score in descending order.
//This example will show the top 10 racers
// If you want to see all racers.. leave out "Limit 10" in the query
$result=mysql_query("select * from racers order by score desc limit 10");
$num=mysql_result($result);

// start a table
echo "<table border=1 cellspacing=5 cellpadding=0>";

// define loop ..
for($i=0;$i<$num;$i++){

// get data from each row of the result
$name=mysql_result($result,$i,"name");
$score=mysql_result($result,$i,"score");

// echo your newy defined variables to the screen
echo "<tr><td align=right><font size=2> $name: </td>
<td><font size=2> $score</td></tr>";
}

// above the loop just ended .. and below we close the table and page
echo "</table>
</body>
</html>";
?>

-- i didn't test this code, .. but if you have questions about it , let me know .. have fun =)
sde is offline   Reply With Quote