I have generated table using html,mysql and php. I want to generate an extra column and have a number inserted in each row of this new column.
echo "<table border='1'>
<tr>
<th>Rank</th>
<th>owner ID</th>
<th>Total</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . '1' . "</td>";
echo "<td>" . $row['owner_id'] . "</td>";
echo "<td>" . $row['total'] . "</td>";
echo "</tr>";
}
echo "</table>";
Now the Rank is the extra column I have generated and where the 1 is, I can currently see it in all rows of this new column. How do I get the other rows to be 2,3,4 ect? I have attempted to insert a new row and inserted a 2 after the “‘1’.” but this just makes the table loose its structure.
1 Answer