Re: keyword search a mysql database.
| From: | Adam Voigt | Date: | Wed, 18 Dec 2002 17:47:22 +0000 |
| Subject: | Re: keyword search a mysql database. | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-24266@lists.php.net to get a copy of this message | ||
$searchstring = $_POST[searchfor];
$searchstring = str_replace(" ","%",$searchstring);
mssql_query("SELECT id FROM table WHERE field LIKE '$searchstring';");
This will give you a looser search where all search terms have
to be there, but not necessarily next to each other, if you want a
"phrase search"
so they have to follow each other:
$searchstring = "%" . $_POST[searchfor] . "%";
mssql_query("SELECT id FROM table WHERE field LIKE '$searchstring';");
Make sense?
On Wed, 2002-12-18 at 12:44, mike karthauser wrote:
I'm looking for tips and tricks in how to approach building a
keyword search
over an number of fields in a courses database.
I know how i can search for one word at a time, but i am not sure on
how i
would approach searching via a defined string.
Anyone got any good pointers for doing this/ or some tutorial that i
can
read though?
Thanks..
BTW kettles on if anyone wants a brew..
--
Mike Karthauser
Managing Director - Brightstorm Ltd
Email >> mikek@brightstorm.co.uk
Web >> http://www.brightstorm.co.uk
Tel >> 0117 9426653 (office)
07939 252144 (mobile)
Snailmail >> Unit 8, 14 King Square,
Bristol BS2 8JJ
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
Adam Voigt (adam@cryptocomm.com)
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc
Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc
Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc