My supplier sends every day an update of the order status with a variable static filename to import in my sql db. My cronjob has the following code:
<?php
require('cron_config.php');
// Open and parse the sales.csv file
$fh = fopen("../files/out/orderstatus.csv", "r");
while ($line = fgetcsv($fh, 1000, ","))
{
$order_id = $line[0];
$order_status_id = $line[1];
$date_modified = $line[2];
// Insert the data into the sales table
$query = "UPDATE oc_order o SET order_status_id='$order_status_id',
date_modified='$date_modified' WHERE order_id = '$order_id'";
$result = $mysqli->query($query);
}
fclose($fh);
$mysqli->close();
?>
In my code you see the static filename "orderstatus.csv". In future I will receive a dynamic filename (example: orderstatus_"order_id".csv. How is it possible to recognize this file with my code? The named order_id is already a part of the sql_query.
Thanks for the help