Despite all the implications of using LIKE in MySQL, sometimes it’s quite useful for a proof-of-concept to be able to use it.
Even though this is a rather trivial example, I hope it will be of help to whoever is wondering how to use a LIKE in a where using a Zend_Db_Select::where() or Zend_Db_Select::orWhere() and did not manage to find decent documentation about it.
As you can see, we bind a parameter to the where() method using the ? symbol, then when assigning the value of this parameter — second parameter — we append the wildcard character %. The new binded parameter value is then string% and which gets quoted and executed giving you the expected output.
We like to blog about things we're passionate about. We love PHP, MySQL, CouchDB, Linux, Apache - web development standards. We also like writing about building web apps and working with web technology.
You can email us on email@example.com