Your prepared statements are incorrect. You do NOT quote the placeholders. e.g.
INSERT INTO foo (bar) VALUES ('?')
^-^--- incorrect
You do
INSERT INTO foo (bar) VALUES (?)
instead. The DB engine will take care of all quoting for you.