On 21 Jul 2017, at 7:33am, Edmondo Borasio <edmondobora...@gmail.com> wrote:
> $db->exec('UPDATE Movies SET name = "new movie" WHERE ID="4"'); Those are the wrong quotes. SQLite requires single quotes around literal strings, and expects no quote around numbers. And PHP doesn’t care which quotes you use as long as they match. Correct line should be as follows: $db->exec("UPDATE Movies SET name = 'new movie' WHERE ID=4"); > $stmt = $conn->prepare('UPDATE Anagrafica SET name=? WHERE hID=?'); Use named parameters. See the example on this page instead: <http://php.net/manual/en/sqlite3stmt.bindvalue.php> so something like $stmt = $conn->prepare("UPDATE Anagrafica SET name=:name WHERE hID=:hid"); $stmt->bindValue(":name", $DbItemName, SQLITE3_TEXT); $stmt->bindValue(":hid", $hId, SQLITE3_INTEGER); If speed is an issue then you can use numbers for the first parameter, but that makes your code less easy to read. Also, make sure you are using the SQLite3 driver, not the standard PDO one. So you should be doing $conn = new SQLite3("path goes here"); You can get away with using the wrong quotes in PHP in some circumstances, but not others, which makes debugging the wrong case extremely difficult. Better to use the right quotes throughout your code even when the wrong ones work. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users