I'm still very new to PHP and pgsql... new to coding in general.
I'm trying to figure out if I should do a while
or do while
loop on this problem.
I need to query a remote source for data and update my db, but I'm limited to the number of returns per call. I have over 1000 rows to update, but my call limit is 100. This means I need to do multiple calls until all rows in a column are no longer null.
I believe this is the right query, but is my while
statement correct?
Here my code:
// $dbconn = connection......
$result = pg_query($dbconn, "WITH data(full_address) AS (VALUES ('location'))
SELECT full_address FROM $table WHERE latitude is NULL limit 5;");
while ($row = pg_num_rows($result > 0)) {
$arr = pg_fetch_all($row);
//curl commands fetch data and ingest
}