Migrate to PHP PDO
make SQL work for both sqlite and mysql