php-db | 2002122
Date: 12/18/02
- Next message: Matthew Moldvan: "RE: [PHP-DB] pictures into MySQL"
- Previous message: mike karthauser: "[PHP-DB] keyword search a mysql database."
- In reply to: mike karthauser: "[PHP-DB] keyword search a mysql database."
- Next in thread: mike karthauser: "Re: [PHP-DB] keyword search a mysql database."
- Reply: mike karthauser: "Re: [PHP-DB] keyword search a mysql database."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
$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 <email protected>
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 <email protected>) The Cryptocomm Group My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc
- application/pgp-signature attachment: This is a digitally signed message part
- Next message: Matthew Moldvan: "RE: [PHP-DB] pictures into MySQL"
- Previous message: mike karthauser: "[PHP-DB] keyword search a mysql database."
- In reply to: mike karthauser: "[PHP-DB] keyword search a mysql database."
- Next in thread: mike karthauser: "Re: [PHP-DB] keyword search a mysql database."
- Reply: mike karthauser: "Re: [PHP-DB] keyword search a mysql database."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

