Get collection from DB, update items in collection and save back to DB (but vanilla PHP)
I'm processing XML and updating MySQL (vanilla PHP).
I would like to do it in 2 MySQL queries (GET ALL DATA -> (edit whole set) -> SAVE ALL DATA BACK)
$allData = mysqli_query($mysqli, "select * from orders'");
$xml = simplexml_load_file('basic.xml');
$list = $xml->order;
//loop XML
for ($i = 0; $i < count($list); $i++) {
//find order inside $allData by record_id
//if status changed, update in $allData
//if doesn't exists, insert new row in $allData
}
//delete from DB rows that weren't found in XML
//save $allData back to database
In Laravel words get collection from DB, update stuff inside and then save it back to DB.