I want an id column generated by php loop and I tried the code below.
This code is working but it skips first row. For e.g. if there are 153 rows, it shows only 152 rows because it skips first row and starts numbering from second row.
$i = 0;
$result = mssql_query ($sql);
$cell = mssql_fetch_array($result);
while ($i <= $cell & $cell = mssql_fetch_array($result))
{
$i = $i + 1;
echo "<tr><td>".$i."</td>";
echo "<td>".$cell[0]."</td>";
echo "<td>".$cell[1]."</td>";
echo "<td>".$cell[2]."</td>";
echo "<td>".$cell[3]."</td>";
echo "<td>".$cell[4]."</td>";
echo "<td>".$cell[5]."</td>";
echo "</tr>";
}
1 Answer