Welcome Guest, Not a member yet? Register   Sign In
How to retrieve data from json column?
#1

(This post was last modified: 09-23-2019, 12:04 PM by jaune.)

I’m a beginner with codeigniter. I’m trying to retrieve data from json column of my sql db.
 The db structure is like this

Code:
DB NAME : order
——————————————————---------------------------------------------------
Id    | description
——————————————————————————————————-----------------------------------
1      | {“pc”: [{ “brand”: “name”}], “description”: [“LL”, “DC”]}
————————————————————————————————————---------------------------------
2      |  {“pc”: [{ “brand”: “name”}], “description”: [“TR”, “KK”]}
————————————————————————————————————---------------------------------
3      |  {“pc”: [{ “brand”: “name”}], “description”: [“DC”, “JJ”]}
————————————————————————————————————---------------------------------

For example, I want to retrieve all instances that has order = dc

Code:
$data = $this->db->select($select)->from(‘order’)
            ->where(“description”, “DC”) ->get()->result();
Reply


Messages In This Thread
How to retrieve data from json column? - by jaune - 09-23-2019, 12:02 PM



Theme © iAndrew 2016 - Forum software by © MyBB