webguy262 Posted November 26, 2010 Share Posted November 26, 2010 I need some help with the query for a form that selects values across multiple columns, and allow users to select multiple values in several columns. http://brinsterinc.com/tpa/tpasearch.php I assume you build the where clause for the sql by determining if there is an option value has been selected in the single-value select boxes. But how do I handle the multi-select list boxes? I'm desperate for help! Need to get somewhere with this over the weekend! TIA! Quote Link to comment https://forums.phpfreaks.com/topic/219868-complex-query-help-multiple-fields-multi-select-list-boxes/ Share on other sites More sharing options...
seanlim Posted November 26, 2010 Share Posted November 26, 2010 $searchStr = array(); foreach ($_POST['s_TPABookOfBusinessPartCount'] as $str) $searchStr[] = '"'.mysql_real_escape_str($str).'"'; $searchStr = implode(",", $searchStr); ... $query = ".... field_name IN (".$searchStr.")..."; Quote Link to comment https://forums.phpfreaks.com/topic/219868-complex-query-help-multiple-fields-multi-select-list-boxes/#findComment-1139753 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.