Re: keyword search a mysql database.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



on 18/12/02 5:47 pm, Adam Voigt at adam@cryptocomm.com 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       >> 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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux