Whenever I execute an “INSERT OR REPLACE” command to sqlite3, it’s actually create duplicate entries instead of overwriting the existing entries.
I created the table in sqlite3 with the following command:
CREATE TABLE mytable (a INTEGER PRIMARY KEY, b VARCHAR(50), c BOOLEAN, d BOOLEAN, e INTEGER, f TEXT, g TEXT, h INTEGER, i DATETIME);
And then I’m executing this:
$database = new POD("sqlite:mydatabase.db");
$database->prepare("INSERT OR REPLACE INTO mytable (b, c, d, e, f, h, h, i) values(?, ?, ?, ?, ?, ?, ?, ?)")
$database->execute('test', 0, 1, -1, 'test', 'test', 12, strtotime('now'));
What could I be doing wrong? Thanks
You should specify in your
createstatement what set of columns should be `unique’ — for exampleNow