如何找出数据库 json 列 Codeigniter 中的变量值?
How to find out if variable value in database json column Codeigniter?
我正在使用 Codeigniter。我试图在数据库中获得一些价值,例如;
$this->db->where('json_value','test1');
问题是 'json_value' 列就像 = [{"name":"test1","value":"test1"},{"name":"test2","value":"test2"}]
如果 'json_value' 有,我怎样才能得到 'test1'?
您可以在查询中使用 LIKE
$this->db->like('json_value', 'test1', 'both');
有关详细信息,请阅读 CI3 documentation。
我正在使用 Codeigniter。我试图在数据库中获得一些价值,例如;
$this->db->where('json_value','test1');
问题是 'json_value' 列就像 = [{"name":"test1","value":"test1"},{"name":"test2","value":"test2"}]
如果 'json_value' 有,我怎样才能得到 'test1'?
您可以在查询中使用 LIKE
$this->db->like('json_value', 'test1', 'both');
有关详细信息,请阅读 CI3 documentation。