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

Reply via email to