If you ever use the deprecated PHP PEAR DB API for using prepared SQL statements that are portable across different database management systems (stop using the mysql_*() functions), I have a fun bug for you! It kept reporting the simple message “DB Error: mismatch”, which generally means the number of parameters you’re passing into the prepared query don’t match the number of markers you’ve made where parameters should be placed (i.e., the question marks).

As you can see, there are two question marks and two parameters passed. After almost an hour of fucking about, I figured out that my dear “DB Error: mismatch” was referring to PEAR not accepting != as a boolean operator even though this is valid in MySQL’s syntax. So no, I had to switch it to <>. Way to go on those error messages. I guess this is why it’s been superseded by the more type-heavy MDB2.

Please note, my final code is much cleaner; I just had to merge a few methods together to make this presentable in a post. Stop staring at me !!