php - Retrieve rows which have comma separated values in corresponding column -


i have category list. , have posts have multiple category. such ..

php category,, first post has php, javascript, wordpress category , second post has php, mysql category in 1 column.

now when click on php category, time posts have php category retrieved.

please idea how can retrieve posts based on 1 category if has multiple category in 1 column.

what need find_in_set() mysql function.

select * tablename find_in_set('php', category_column); 

find_in_set() returns position of php in category_column, used in where clause true except 0, returned when substring not found.

as disclaimer i'd mention, seems, have bad design of database. shouldn't put multiple values in 1 field. may in trouble developing further features in app later.


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -