Wednesday, June 24, 2009

PHP SQLite 3 exec not working

I've spent at least a week wondering why my db->query statements work on my PHP files whereas the db->exec randomly seems to work or ceases working. This is mostly with the PDO opening of SQLite 3 onwards, where it behaves almost read-only.

Turns out, not only do you need to allow write access to the database file itself, but also to the folder containing it. Some google searches also seem to suggest that the full path needs to be given. But trust me - simply enabling write on the directory worked. This seems like a potential security issue, though :(

P.S. - For my facebook friends being forced to read this note - sorry, I'm still trying to figure out how to decouple the RSS I had once linked. :(

1 comment:

  1. Thanks! You just saved me one week of time. You blog turn out to be the second result after

    Keep your the great work.
    Thanks for sharing.