Matl Posted April 11, 2011 Share Posted April 11, 2011 Hello, I have a very basic search form that I would like to be able to pass to my PHP processing script so that a single column in the Mysql table can be matched against all comma separate values that the user enters into the form text area field. I can't seem to get the exact solution. Form text area is named: center $centersearch=$_POST["center"]; SELECT * FROM cities WHERE center LIKE '%$centersearch%' Would I need to do a pregreplace to eliminate the commas before using them in my query or enter them into an array of some sort? Thanks in advance! Quote Link to comment https://forums.phpfreaks.com/topic/233386-text-area-csv-search/ Share on other sites More sharing options...
Matl Posted April 11, 2011 Author Share Posted April 11, 2011 Oh yes, this is on RHEL 5, Apache 2.2.3, Mysql 5.0.77 and PHP 5.2.10 Quote Link to comment https://forums.phpfreaks.com/topic/233386-text-area-csv-search/#findComment-1200213 Share on other sites More sharing options...
fenway Posted April 19, 2011 Share Posted April 19, 2011 If it's really comma separated, you can cheat with FIND_IN_SET(). Quote Link to comment https://forums.phpfreaks.com/topic/233386-text-area-csv-search/#findComment-1203430 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.