Adding rank field in database.
I have a query that gets all the news stories from my table by date. What I'd like to do is on each row insert an entry into the field rank that starts with 1 for the first row, then goes in sequential order. So the first would would be 1, the second would be 2, etc, through all the rows.
Here is the code I have so far:
<?
require ( "conf.php" );
$stories_rs = $conn->Execute ( "SELECT * FROM story ORDER BY date DESC" ) or die ( $conn->ErrorMsg() );
while ( ! $stories_rs->EOF ) {
$sql = "UPDATE story SET rank = $rank WHERE storyID = $storyID";
$add_rank_rs = $conn->Execute($sql) or die ( $conn->ErrorMsg() );
$stories_rs->MoveNext(); }
?>
I want to replace $rank with the numbers...