What I'm trying to do is display & count the number of rows from my query
"SELECT * from squads where activated='1' order by points desc limit 25"
So what I'm doing is displaying the top 25 squads from 1-25... my problem is that the squad with the most points is not displayed... I'm certain this is because my code is incorrect...
Example:
In Database (phpmyadmin):
Squad / Points
abc / 400
123 / 399
def / 300
Here is what my code (below) is spitting out:
Rank / Squad / Points
1 / 123 / 399
2 / def / 300
As you can see (I hope I was clear enough), the 1st result isn't displayed... I know there is somthing wrong with my code, but where? what?... ๐
The Code
<?php
// Database Connection
$db = mysql_connect("localhost","xxx","xxx");
mysql_select_db (xxx);
$sql = mysql_query("SELECT *
FROM `squads`
ORDER BY `points` DESC LIMIT 0 , 25");
while($row = mysql_fetch_array($sql)) {
for($i=1;$row=mysql_fetch_array($sql);$i++) {
echo('<table width=100% cellpadding=0 cellspacing=0>
<tr>
<td width=5%><font face=Verdana size=1 color=#ffffff><B><center>'.$i.'</B></td>
<td width=40%><font face=Verdana size=1 color=#736f5e> <B>ยป </B><font face=Verdana size=1 color=FFFFFF><a href=squad.php?userid='.$row["userid"].'>'.$row["squad_name"].' </a></td>
<td width=15%><font face=Verdana size=1 color=#ffffff><center>'.$row["points"].'</td>
<td width=15%><font face=Verdana size=1 color=#ffffff><center>'.$row["win"].'</td>
<td width=15%><font face=Verdana size=1 color=#ffffff><center>'.$row["loss"].'</td>
<td width=10%><font face=Verdana size=1 color=#ffffff><center><img src=images/'.$row["trend"].'.gif></td></tr>
</table>');
}
}
?>