Skip to content

Instantly share code, notes, and snippets.

@settermjd
Created June 18, 2013 04:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save settermjd/5802655 to your computer and use it in GitHub Desktop.
Save settermjd/5802655 to your computer and use it in GitHub Desktop.
Creating a nested SQL query with \Zend\Db\Sql
$select->where(array("ItemID" => (int)$itemId));
$select->where->and->nest
->like('FirstName', $inputFilter->getValue("searchCriteria") . "%")
->or->like('FirstName', "%" . $inputFilter->getValue("searchCriteria"))
->or->like('LastName', $inputFilter->getValue("searchCriteria") . "%")
->or->like('LastName', "%" . $inputFilter->getValue("searchCriteria")
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment