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! 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.")..."; 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
Archived
This topic is now archived and is closed to further replies.