I have a table called "zip_codes" with columns ZIP, STATE, LATITUDE, LONGITUDE, CITY, FULL_STATE, and POINT.
I'm trying to write a script to automatically take the latitude and longitude of each row, divide them, and put the result into column POINT(BIGINT type).
This is the code I currently have:
Code: Select all
$result = mysql_query("SELECT * FROM zip_codes");
while ($row = mysql_fetch_array($result)) { //set variables for rows
$lat = $row['latitude'];
$lon = $row['longitude'];
}
$sql = "UPDATE zip_codes SET point = ($lat / $lon)";
$result = mysql_query($sql);