Im trying to create a block that will display a rows in another mysql table.
I put the code in but my site turns all messed up with alignment when i do. I get the feeling im not doing it right.
|
Code:
|
<?php
$db = mysql_connect("localhost","*****","******") or die("Problem connecting");
mysql_select_db("ladder") or die("Problem selecting database");
$query = "SELECT * FROM ladder_1 ORDER BY games desc";
$result = mysql_query($query) or die ("Query failed");
$numofrows = 10;
?><?php
echo "<TABLE BORDER=\"1\" font color=\"white\">\n";
echo "<TR bgcolor=\"#003366\"> <TD>Zone Nic</TD><TD>Points</TD></TR>\n";
for($i = 0; $i < $numofrows; $i++) {
$row = mysql_fetch_array($result);
if($i % 2) {
echo "<TR bgcolor=\"black\">\n";
} else {
echo "<TR bgcolor=\"black\">\n";
}
echo "<TD>".$row['name']."</TD><TD>".$row['games']."</TD>\n";
echo "</TR>\n";
}
echo "</TABLE>\n";
?> |
thats my code and obviously its wrong
Could someone help me please....