View Single Post
Old 05-12-2012, 12:26 PM   PM User | #5
kipal
New to the CF scene

 
Join Date: May 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
kipal is an unknown quantity at this point
Quote:
Originally Posted by Old Pedant View Post
It's actually much easier to do this in the server in PHP code, anyway.

You just check to see if you got any values in $_GET["keyword"] and, if so, just convert all the values into an IN( ) list for your SQL query.

I don't use PHP, but I *believe* it would be something like this:
Code:
if ( isset($_GET["keyword"]) )
{
    $list = "";
    for ( $i = 0; $i < count( $_GET["keyword"] ); ++$i )
    {
        if ( $i > 0 ) $list .= ",";
        $list .= "'" + mysql_real_esape_string($_GET["keyword"][$i]) + "'";
    }
    $sql = "SELECT * FROM table WHERE somefield IN (" . $list . ")";
    ...
}
i thought a form can only send its own value and not that of other forms....i'll incorporate a form and try this out and let you know
kipal is offline   Reply With Quote