surfsup Posted February 19, 2009 Share Posted February 19, 2009 OK this is a bit basic probably BUT I have 2 recordsetsRS1 RS2 RS1 has one record with column Food1 conataing cheese,ham,toast RS2 also has column Food2 but with only one food type. I want to filter RS2 so it only shows those records have one of the comma seperate values in it's Food Column Does that make sense Thanks Quote Link to comment https://forums.phpfreaks.com/topic/145937-solved-filter-with-comma-seperated-values/ Share on other sites More sharing options...
limitphp Posted February 19, 2009 Share Posted February 19, 2009 OK this is a bit basic probably BUT I have 2 recordsetsRS1 RS2 RS1 has one record with column Food1 conataing cheese,ham,toast RS2 also has column Food2 but with only one food type. I want to filter RS2 so it only shows those records have one of the comma seperate values in it's Food Column Does that make sense Thanks Let me try to clarify: You want to display rows that have no commas in column Food2? Quote Link to comment https://forums.phpfreaks.com/topic/145937-solved-filter-with-comma-seperated-values/#findComment-766136 Share on other sites More sharing options...
sasa Posted February 19, 2009 Share Posted February 19, 2009 $sql="select * from RS2 where Food2 in ('". str_replace(',', "','", $Food1)."')" Quote Link to comment https://forums.phpfreaks.com/topic/145937-solved-filter-with-comma-seperated-values/#findComment-766139 Share on other sites More sharing options...
surfsup Posted February 19, 2009 Author Share Posted February 19, 2009 Excellent thanks worked a treat Quote Link to comment https://forums.phpfreaks.com/topic/145937-solved-filter-with-comma-seperated-values/#findComment-766147 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.