Hi all, I'm using the query below to find all rows in my database where the number 26 appears in a particular string of comma separated numbers such as: (1,4,8,25,26,36,136,145) $matches = mysql_query("SELECT * FROM allitems WHERE allgenres LIKE '%26%'"); Code (markup): But it's not just returning the rows where the number 26 appears but also the rows where the number 126 or the number 226 appear and so on. How do I limit it to just the number 26?
Maybe %,26,% instead, since % is basically a wild card, so obviously 126 and 226 would be true. So you might have to do something like WHERE allgenres LIKE '26,%' OR allgenres LIKE '%,26,%' OR allgenres LIKE '%,26' OR allgenres = '26' Just to cover those variations.