Hi,
I’m trying to implement this flow:
- Receive file about a given date and shift;
- Delete any information about that date and shift that exists in the database;
- Insert the received information;
I’m having trouble with step two. The code I’m using is this:
$cleanupSql = "DELETE FROM `Turnos` WHERE Dia = :Dia AND Turno = :Turno ";
$cleanupSth = $conn->prepare($cleanupSql);
(...)
$temp = date_format($date,"Y-m-d");
$cleanupSth->bindParam(':Dia',$temp,PDO::PARAM_STR);
$cleanupSth->bindParam(':Turno',$splited[2],PDO::PARAM_STR);
$cleanupSth->execute();
$temp is equal to 2018-10-18 and splited[2] is “1”. dia of type date and Turno of type varchar.
I’ve also tried to use ? params, passing the dateTime object.
When I run this query in the database, which , it works
DELETE FROM `Turnos` WHERE Dia = "2018-08-18" AND Turno = "1"