etrader Posted July 20, 2011 Share Posted July 20, 2011 I search for words in mysql by mysql_query("SELECT * FROM Articles WHERE Tags LIKE '%$q%'", $con); But I have problem with my tags as they are stored as "tag1,tag2,tag3". Now I want to get every article which contains "tag1"; but this does not work as LIKE %tag1% needs space to detect a word; though my tag list is comma separated. Link to comment https://forums.phpfreaks.com/topic/242433-searching-for-tags-in-mysql/ Share on other sites More sharing options...
dragon_sa Posted July 20, 2011 Share Posted July 20, 2011 couldnt you use str_replace first on $q to change the , to a space then do the query $q=str_replace(",", " ", $q); Link to comment https://forums.phpfreaks.com/topic/242433-searching-for-tags-in-mysql/#findComment-1245133 Share on other sites More sharing options...
etrader Posted July 20, 2011 Author Share Posted July 20, 2011 Sorry it was my mistake! Link to comment https://forums.phpfreaks.com/topic/242433-searching-for-tags-in-mysql/#findComment-1245134 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.