<?php

$records = $db->run("SELECT * FROM project ORDER BY id ASC");
foreach ( $records as $record ) {
    $zip = $db->cell("SELECT zip FROM project WHERE id = ?", $record['id']);

    //get lat lon
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "http://api.openweathermap.org/geo/1.0/zip?zip=$zip,US&limit=1&appid=6ac59cfe89efa30a2359dd9462cdaf61");
    curl_setopt($ch, CURLOPT_HTTPHEADER, ['Accept: application/json, Content-Type: application/json']);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $response = json_decode(curl_exec($ch));
    curl_close($ch);

    $city = $response->name;

    $db->update('weather', ['city' => $city], ['projectId' => $record['id']]);
}