I have a table (customer) with 10,000 records. I would like to modify every single record one at a time and modify some data then update it back into the database. It doesn’t make sense to SELECT * FROM customer then fetchAll since there are 10,000 records.
I’d like to create a while loop in PHP which does a incrementing SELECT statement but what would a select statment like this look like if there is no stable primary key that increments nicely? Logically the while loop would look like:
$row = 1;
while(Number_Rows_In_Table)
{
$record = $this->db->exec("SELECT * FROM customer WHERE ROW = $row");
$row++;
//Do something with the data then update it
}
Is there a way to do this?
You don’t have to use fetchAll you know:
This will be much faster than having 10,000 select queries. I can guarantee you that.