Re: [PHP-DB] keyword search a mysql database.
I found the following article http://www.zend.com/zend/tut/tutorial-Ferrara.php to be very useful David Eisenhart "John W. Holmes" <[EMAIL PROTECTED]> wrote in message 001f01c2a6ca$43ae82b0$7c02a8c0@coconut">news:001f01c2a6ca$43ae82b0$7c02a8c0@coconut... > FULL TEXT index? > > http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html > #Fulltext_Search > > ---John W. Holmes... > > PHP Architect - A monthly magazine for PHP Professionals. Get your copy > today. http://www.phparch.com/ > > > -Original Message- > > From: mike karthauser [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, December 18, 2002 12:44 PM > > To: [EMAIL PROTECTED] > > Subject: [PHP-DB] keyword search a mysql database. > > > > 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 >> [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 > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] keyword search a mysql database.
on 18/12/02 5:47 pm, Adam Voigt at [EMAIL PROTECTED] wrote: > $searchstring = $_POST[searchfor]; > $searchstring = str_replace(" ","%",$searchstring); > > mssql_query("SELECT id FROM table WHERE field LIKE '$searchstring';"); I've modified my query to $result = mysql_query("SELECT coursecode, title FROM courses WHERE title LIKE '$tsearch' ORDER BY title",$db); Where $tsearch is my search string. I'm not getting any results from this though What i am trying to achieve is to look in title and produce a result if the string appears. so searching for 'Training Course" will find results like Training Course 1 Training Course 2 Training Course n, etc. Is LIKE the best way to do this or should i be using wildcards? -- Mike Karthauser Managing Director - Brightstorm Ltd Email >> [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
RE: [PHP-DB] keyword search a mysql database.
FULL TEXT index? http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html #Fulltext_Search ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ > -Original Message- > From: mike karthauser [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, December 18, 2002 12:44 PM > To: [EMAIL PROTECTED] > Subject: [PHP-DB] keyword search a mysql database. > > 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 >> [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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] keyword search a mysql database.
$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 >> [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 ([EMAIL PROTECTED]) The Cryptocomm Group My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc signature.asc Description: This is a digitally signed message part
[PHP-DB] keyword search a mysql database.
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 >> [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