$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?


BTW kettles on if anyone wants a brew..
Mike Karthauser
Managing Director - Brightstorm Ltd

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
The Cryptocomm Group
My GPG Key:

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to