1

I have a column in table which has possible values of tom,john,jerry(SET). I have a variable that a user enter and I store it in $var and want that at some point. I could check that if the value in $var exists in particular row then don't update else update, How I can do this in PHP. I have several rows like tom,john

    john,jerry

I dont want tom,john,tom

4

1 回答 1

0

我有一个建议。

请更改数据库值,以便您拥有:(,tom,john,tom,注意附加和前面的逗号,

现在,如果您想搜索tom,请触发如下 SQL:

SELECT id FROM DB_TBL WHERE field LIKE '%,$val,%'

对用户输入的所有值重复此操作,或用逗号放入单个文本框中。

希望这有效。

于 2013-10-02T16:18:16.630 回答