[Solar-talk] sql LIKE

Antti Holvikari anttih at gmail.com
Mon Sep 25 05:37:30 PDT 2006


On 9/25/06, Jeff Surgeson <solar at 3hex.com> wrote:
> Hi Guys
>
> Trying to create a LIKE clause but cant seem to get it right, it is under
> Solar (VER 0.19) and mysql, sorry old site.
>
> I currently have (part of my select) which works,
>
> $where = array();
> $where['book_title = ?'] = $form_val;
>
> // get the list of results
> $this->list = $this->bd_books->fetchAll($where, $order, $page);
>
> How would I change this to include a 'book_title' LIKE $form_val as apposed
> to 'book_title' = $form_val
>
> I cant get the syntax correct.

I think this would work:
$where['book_title LIKE ?'] = '%' . $form_val . '%';


-- 
Antti Holvikari <http://phphalo.com>


More information about the solar-talk mailing list