You are really right, Forgive me!
Makes me keep the wrong job by asking how to do it
Amateurish I tried to write cron with php
I update the USD and EURO currency to the local currency i.e. exchange rates
id:1, USD => local currency
id:2, EURO => local currency
id:3, EURO = USD
I update twice every day at 10:00 and 16:00 on working days.
I update at 10:00 and set it to the next time. no problem here
However, if the exchange rates have not changed during the update process at 16:00, the update fails and cannot be adjusted to the next time.
As the update fails, it tries to update frequently and writes “Failed” logs to the database.
foreach ($rates AS $key => $value){
$id = $value['id'];
$doviz = $value['doviz'];
$birim = $value['birim'];
$tcmb = $value['tcmb'];
$query = $PDOdatabase->prepare("UPDATE kuru SET doviz=?, birim=?, tcmb=? WHERE id=? ");
$query->execute([$doviz,$birim,$tcmb,$id]);
if ($query->rowCount() > 0) {
$result = "Successful";
} else {
$result = "Unsuccessful";
}
}
echo $result;
From here, how can I get a “Successful” message if the current data and the recorded data are the same, ie no update is required?
On the other page, you can assume the update was successful and set it for the next time.
Or, how should do?