php + sql search

Mark Stewart Mark.Stewart at
Fri Nov 1 12:46:22 GMT 2002

I have done this loads of times and the oreilly example was spot on.

You have to dynamically build your query string to get the data you want.

I usually use the split function on the search field to get the options sur=
rounding the + sign, then loop around the resulting array to build that par=
t of my query string.


-----Original Message-----
From: buu [mailto:buu at]
Sent: 31 October 2002 15:17
To: Freebsd Forum
Subject: Re: php + sql search

U have to parse the input data OR maybe there are some sql functions u can
use... i'm not sure on that and i'll check later on (sql server has them...
dunno if mysql).
Ill reply in about 3 hours since now i have to go to the police =3D/ bha eh=


----- Original Message -----
From: "Robin Garbutt" <rob at>
To: "Freebsd Forum" <freebsd-users at>
Sent: Thursday, October 31, 2002 2:35 PM
Subject: php + sql search

> Hi all,
> I want to be able to query by mysql db with a boolean search.
> at the mo I have:-
> $result =3D mysql_query("SELECT * FROM db WHERE name LIKE '%$name%'", $db=
> $query_data =3D mysql_fetch_array($result)
> ideally I would like to be able to type in the search box "something +
> something" to search db with queries like.  Eg. "cat + dog" to return all
> listings containing the words cat and dog.
> has anyone any ideas?
> many thanks in advance!
> Robin Garbutt
> Portfolio Art & Design Ltd
> Tel -  +44 (0) 1204 383822
> Fax - +44 (0) 1204 383866
> Mob - +44 (0) 7811 185490
> e-mail - Rob at
> For further information please visit us at :-
> The contents of this e-mail are confidential to the ordinary user of the
> e-mail address to which it was addressed and may also be privileged. If
> are not the addressee of this e-mail you may not copy, forward, disclose
> otherwise use it or any part of it in any form whatsoever. If you have
> received this e-mail in error please e-mail the sender.
> ------ FreeBSD UK Users' Group  -  Mailing List ------

------ FreeBSD UK Users' Group  -  Mailing List ------


You can find us at

This communication is confidential and intended for=20
the exclusive use of the addressee only. You should=20
not disclose its contents to any other person.
If you are not the intended recipient please notify=20
the sender named above immediately.

BACS Limited, registered in England, No 1023742,=20
3 De Havilland Road, Edgware, Middlesex, HA8 5QA

More information about the Ukfreebsd mailing list