Duplicate events imported manually
-
Hi,
I create events manually by importing them from an API.
The day after importing an event I find duplicate records in the mec_dates table.Example:
start date from api: “Tue, 29 Jun 2021 00:00:00 +0200”
end date from api: “Tue, 29 Jun 2021 23:59:59 +0200”my php code
$strtotimeDataInizio = DateTime::createFromFormat("D, d M Y H:i:s O", $event['datainizio']); $datainizio = $strtotimeDataInizio->format("Y-m-d"); $strtotimeDataFine = DateTime::createFromFormat("D, d M Y H:i:s O", $event['datafine']); $datafine = $strtotimeDataFine->format("Y-m-d"); $sql_insert_dates = "INSERT INTO ".$wpdb->prefix."mec_dates ( <code>post_id</code>, <code>dstart</code>, <code>dend</code>, <code>tstart</code>, <code>tend</code>, <code>public</code>) VALUES (". $event_id . ", '".$datainizio."', '".$datafine."', ".strtotime($strtotimeDataInizio->format("D, d M Y H:i:s O")).", ".strtotime($strtotimeDataFine->format("D, d M Y H:i:s O")).", 1)"; $wpdb->query($sql_insert_dates);
Here’s the inserted record
1007 2347 2021-06-29 2021-06-29 1624917600 1625003999 1After a while, I think about midnight on the day of insertion, I always find an additional record in mec_dates.
1014 2347 2021-06-29 2021-06-29 1624924860 1625011140 1
I have inserted 92 records and it has always happened.
Do you know why?
ty
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Duplicate events imported manually’ is closed to new replies.