I have a table with over a thousand records that I need to update a field I have called "id". I need each record's ID to be unique. I am using the uniqid() function which works just fine. When I use the code below (and several other variations of it), all records have the same value as the last record. The screen output shows each ID to be different. I even substituted the For Loop counter and all the records had the same value. How can I update each record so each has a different value? This program will probably be run only once so efficiency in speed is not an issue.
Screen Display
Row ID
0 51ff1474280a0
1 51ff14742c475
2 51ff14742ffcb
3 51ff147433c21
1910 51ff1493082b1
1911 51ff14930c142
$resultset = mysql_query("SELECT * FROM mailing");
for ($i=0; $i<=1912; $i++) {
mysql_data_seek($resultset,$i);
$id = uniqid();
$query="UPDATE mailing SET id_key='$id'";
mysql_query($query) or die ("Error in query: $query <br>" . error_message);
echo $i . " " . $id . "<br>";
}