开发者

Best way to use activerecord to look for ID number in JSON encoded string

I am storing JSON strings of ID numb开发者_Go百科ers in my database for some website settings. I need create an active record query to look for an ID number in this string. What's the best way to do this?

Example of stored string:

["25","26","27","28","29"]

I was thinking perhaps:

$this->db->like('settings', '"28"');

However, this seems a little improvised...


I think you are searching for something like:

$this->db->where_in('id', json_decode('["25","26","27","28","29"]'));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜