0
Good morning, everyone. I’m having a question I can’t seem to solve.
In a given table of a BD I have a column that saves a string as follows:
1,2,3,4,5 Line 1
11,22,33,44,55 Line 2
Now I need to do a search to select only the lines that have given number by ex:
Select column X where it contains the number 2
I tried to do the search using the code below, but it is returning me both line 1 and line 2, but I only needed line 1 which is where there is exactly number 2 and not the line where there is number 22
$sql = 'SELECT `ativos` from `produtos` WHERE `ativos` LIKE "%'.$id.'%"';
Does anyone have any idea how I can solve this problem? Thanks in advance
It worked by removing the "IS NOT NULL" part. Thank you very much
– Frederico Moreira
Oops, updated response. You’re welcome :D .
– Marlysson