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.
You can leave a response, or trackback from your own site.
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 freedom@echolibre.com
Eamon Leonard - @EamonLeonard
David Coallier - @DavidCoallier
Helgi Þormar Þorbjörnsson - @h
J.D Fitz.Gerald - @jdfitzgerald
Noah Slater - @nslater
Court Ewing - @courtewing
(2)
(5)
(2)
(4)
(3)
(5)
(2)
(1)
(35)
(1)
(3)
(1)
(1)
(28)
(12)
(1)
(2)
(2)
(3)
(1)
(1)
(3)
(1)
(1)
(15)
(1)
(5)
(6)
(6)
(1)
(21)
(3)
(1)
(2)
(2)
(1)
(5)
(3)
(1)
(2)
(3)
(1)
(3)
(4)