I\'m having a bit of trouble inserting into a sqlite3 database with pdo. You\'ll have to excuse my ignorance with PDO, it seems so foreign coming from Python\'s database interfa
One of the great benefits of PDO is that you can create prepared statements. Here's some code from a PHP project of mine:
$qry = $db->prepare(
'INSERT INTO twocents (path, name, message) VALUES (?, ?, ?)');
$qry->execute(array($path, $name, $message));
As you can see, I use ?
where I want to insert a value, then I execute the query with an array of values that should be put in place of the question marks.
If you do this, your query will be much safer, and more likely to work (since a missing value would stop your query from working if you insert variables directly in the query like you do.)