When developing apps by using SQLite as a storage backend, you most likely will sometime get the error message:
The message very clearly describes what happened: you have prepared an SQL statement like "SELECT ... WHERE id=? OR id=? OR id=?" or at least something like that, and the placeholders (in this case the question marks) are too many.
Today I decided to provide a brief introduction into using SQLite compared to mySQL for PHP and webserver environments.
Traditionally mySQL is first choice when developing a dynamic website with PHP. Recently SQLite is another database system (I intentionally don't call it a database server, see below for reasons why) getting very popular. SQLite has two main usage areas: Webservers (mainly with little performance requirements) and applications.
In this quick article I'd like to comment a special case which is very much undocumented yet.
Today I eventually started optimizing the performance (thereby reducing server load a bit). It appeared some pages of my larger websites have grown to round about 300 kb causing some latency for lower bandwidth visitor. Having a quite good connection myself, I didn't care about that much in the past. But that's ab pity, because it is very simple to add compression to pure PHP-generated content.
Redirecting whole websites or single webpages with mod_rewrite is a very important feature when doing search engine optimization (SEO) or when moving from one webserver or domain to another.
Redirection is usually done with a small block of code that is added to an .htaccess file in your websites root path. The code snippet looks like:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.example\.com$
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
It is often misunderstood and the bulletin boards have hundrets of incomplete or wrong assumptions about Apache and mod_rewrite. That's why I decided to write an article about it.