views:

133

answers:

1

I want to use a query which uses LIKE .. for e.g select * from xxxx where zzzz LIKE 'a%'; How can I do that using Zend DB?

I have already tried something like $db->query('SELECT * FROM XXXX where zzzzz LIKE ?','\'' . $query .'%\''); but it is not working.

Thanks

+3  A: 

You're double quoting. You don't need the escaped quotes around $query. Prepared statements will take care of that for you:

$db->query('SELECT * FROM XXXX where zzzzz LIKE ?', '%' . $query .'%');
Mark
Thanks Mark .. sorry for the late reply