I have a simple php script: <?php $result = mysql_query("SELECT * FROM characters"); echo "<table border='1'> <tr> <th>Character Name</th> <th>Level</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['name'] . "</td>"; echo "<td>" . $row['level'] . "</td>"; echo "</tr>"; } echo "</table>"; *just an example* and I want to order each result from 1-50. How would I do that?
Try this: <?php $result = mysql_query("SELECT * FROM characters"); echo "<table border='1'> <tr> <th>Character Name</th> <th>Level</th> </tr>"; $count = 1; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $count . "</td>"; echo "<td>" . $row['name'] . "</td>"; echo "<td>" . $row['level'] . "</td>"; echo "</tr>"; $count++; } echo "</table>"; PHP: