mysql - How to search with comma separated values -
i have 5 check boxes,
<label class="checkbox-inline"><input type="checkbox" name="manhattan" value="manhattan" >manhattan</label> <label class="checkbox-inline"><input type="checkbox" name="bronx" value="bronx" >bronx</label> <label class="checkbox-inline"><input type="checkbox" name="brooklyn" value="brooklyn" >brooklyn</label> <label class="checkbox-inline"><input type="checkbox" name="queen" value="queen" >queen</label>
i want search
--------------------------------- id | location --------------------------------- 1 | manhattan,brooklyn,queen 2 | queen,brooklyn ---------------------------------
here query
extract($_post); $locprefervals = $manhattan.",".$bronx.",".$brooklyn.",".$queen.",".$staten; $locprefer = rtrim($locprefervals,','); $query = "select * tbl location='".$locprefer ."'";
when user checked location in check boxes need compare data table "location" each comma separated values.
Comments
Post a Comment