i have some value stored in my database in the column "", like i shown below in the given pic,
Now if you can notice then there on the number three position we have value which is as Italian,Pizzeria(Pizza), there may be some more values that can contain COMMA (,) LIKE Italian,Pizzeria(Pizza) have as we can see in the pic below,
Now i want to fetch all the values though php (select * from tablename) but if the value contains the COMMA then i want that value to be excluded, any way to filter column content ? i want to only select values that doesn't have any comma, thanks in advance ? till in my knowledge may pregmatch, or array filter can help.
Use the NOT LIKE
predicate:
select *
from tablename
WHERE merchant_cuisine NOT LIKE '%,%';
You can do this within MySQL:
select * from tablename
where locate(',', merchant_cuisine) = 0
See also: LOCATE()
As I have understood from the question, you want to fetch only rows, which do not contain a comma symbol in the merchant_cuisine
column. Try this query then: SELECT * FROM tablename WHERE merchant_cuisine NOT LIKE '%,%'