I have table students containing data like given below :
id name activity
1 susan 1,2
2 denny 1,2,3
3 ken 3
I want to choose all the data like name and id from this table having activity equal to 2. I have done a sql query using like but it will not work.
$sqll = mysqli_query($con,"SELECT id,studentname FROM students WHERE activity LIKE '%$activity'");
If another row contains data like id : 4 name:ben activity : 22
it will show this row also. I want the rows containing activity 2 only.
Can anyone suggest a solution for this ?