0
votes

So, i'm trying to update multiple lines with a prepared statement in PDO:

UPDATE uploads SET stored_until=:stored_until WHERE name IN (FIND_IN_SET(uploads.name, :name_list))    

And i'm getting an axception

Uncaught PDOException: SQLSTATE[22007]: Invalid datetime format: 1292 Truncated incorrect DOUBLE value: '5320f3c10eb41fe3ceaf65c3b457538e.txt'

I understood, that somehow some "name" from Array is counting as a Date, but i can't understand why

Colums, that used in code:

`name` VARCHAR(64) NOT NULL,
`stored_until` DATE NULL DEFAULT NULL

Here's the part, where query executes

$name_list = $json['files'];
$date = new DateTime($_GET['date']);
$date->modify("+2 weeks");
$query->execute(array("stored_until" => $date->format("Y-m-d"), "name_list" => $name_list));
It looks like you're trying to insert the name in to the date field. Perhaps you have your parameters :stored_until and :name_list mixed up in your PHP. Show us the code where you construct the query. - Moob
Your stored_until column is defined as a DATE, and you try to pass it a filename. Look at how you assign your variables to the update statement. Add your code here, without it, we do not have much to go on. - Nic3500