0

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));
IllidariCat
  • 111
  • 2
  • 8
  • 2
    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 Oct 23 '17 at 17:13
  • 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 Oct 23 '17 at 17:14
  • Does this answer your question? [MYSQL Truncated incorrect DOUBLE value](https://stackoverflow.com/questions/3456258/mysql-truncated-incorrect-double-value) – Elikill58 Apr 05 '23 at 09:46

0 Answers0