Re: [PHP] multiple keywords in search boxes

2002-09-05 Thread timo stamm

Hi Jason,


have a look at Richard Lynchs reply posted at Sat, 31. Aug. 
2002  03:08:39 Europe/Berlin with subject "[PHP] Re: performing 
searches with random entries"


Timo


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] multiple keywords in search boxes

2002-09-04 Thread Robert Cummings

Jason wrote:
> 
> Hi,
> What is the necessary code to return a recordset from a single text box with
> more than one keyword in it (like most search engines do)?
> Thanks

This is basic, and syntax is not checked...

if( is_array( ($words = split( '[[:space:]]+', $GET['keywordInput'] )) )
&&
count( $words ) > 0 )
{
//
// Initialize query.
//
$qString =
'SELECT xx, yy, .. FROM foo_table '
   .'WHERE ';

//
// Create condition clause from word list.
//
foreach( $words as $word )
{
$qString .= "zz LIKE '%".addSlashes( $word )."% AND ";
}

//
// Trim the extraneous AND.
//
$qString = substr( $qString, whatever goes here to trim AND );

//
// Perform query.
//
}


-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] multiple keywords in search boxes

2002-09-04 Thread Jason

Hi,
What is the necessary code to return a recordset from a single text box with
more than one keyword in it (like most search engines do)?
Thanks



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php