Location: PHPKode > projects > Blackbeard's Revenge > listplayers.php
<?php
require_once "headers.php";
require_once "common.php";

echo"<BODY><div align=left>";
print "<form action=\"inn.php\" method=\"POST\">";
echo "<br><br>";
echo "<table class=\"menu\">";
echo "	<tr>";
echo "		<td class=\"menuheader\" style=\"height:25px;width:450px;text-align:center\">Player List</td>";
echo "	</tr>";
print "	<tr><td colspan=2><div align=center><table class=\"data\" border=0 style=\"width:420px\">";
print "	<tr><td class=\"header\">In the realm</td></tr><tr><td>";


	$query = "SELECT * FROM players ORDER BY level DESC";
	$result = db_query($query);

	/* Printing results in HTML */
	print "<table border=0 class=\"data\" style=\"width:420px\">\n";
	print "<tr><td class=\"header\">Name</td><td class=\"header\">Age</td><td class=\"header\">Ship Name</td><td class=\"header\">Level</td></tr>";

	$x = 1;	
	
	while ($row = db_fetch_assoc($result)) {
		if($x == 1)	{
			$sytle = "menubody1";
			$x = 0;
		}
		else {
			$sytle = "menubody2";
			$x++;
		}
		echo "<tr>";
		echo "<td class=\"".$sytle."\">" . $row["name"] . "</td>";
		echo "<td class=\"".$sytle."\">" . $row["age"] . "</td>";
		echo "<td class=\"".$sytle."\">" . $row["shipname"] . "</td>";
		echo "<td class=\"".$sytle."\">" . $row["level"] . "</td>";
		echo "</tr>";		
	}	
	/* Free resultset */
	db_free_result($result);

	echo "</table>\n";
	print "</td></tr></table></td></tr>";
	print "</table>";
	
?>
Return current item: Blackbeard's Revenge