Hi
I have a DB table with the fields: location, authority, long, lat. The table has 45000 records. I have inserted an 'id' field at the beginning of the table.
How do I add auto incrementing values startting at 1?
I wrote this but it adds the same value to each record:
<?
include ("connect.php");
$query = mysql_query("SELECT * FROM towns ORDER BY location");
$i=0;
while ($autonum = mysql_fetch_array($query))
{
$i++;
$up_query = mysql_query("UPDATE towns SET id='$i'");
}
?>