![]() |
I need to build JSON_REPLACE query like this:
Code: UPDATE table_name How do can I build json_replace in CI4?! thanks.
->where('id', 10)->set('subjectcombination', "JSON_REPLACE(subjectcombination, '$.subjectcombination[0].college', 'ABC')", false)
@iRedds : Thanks for your reply.
My Json is: Code: { And I test with your approach: Code: $builder = $this->db->table('users'); In action I see this error: Code: Invalid JSON path expression. The error is around character position 27. (03-06-2022, 02:46 AM)iRedds Wrote: $.settings[0].social-enable = {"settings" : [ { "social-enable" : 1} ]} @iRedds : I change to this but I see same error: Code: {
@alakian Why don't you check the SQL that the Query Builder create?
Or why don't you use $db->query() ? https://codeigniter4.github.io/userguide...ar-queries
@kenjis : I think my problem not related to the query method. I'v created my query use $db->query() like this:
Code: $this->db->query('UPDATE users SET information = JSON_REPLACE(information, "$.settings[0].social-enable", "0")'); In action I saw same error!! |
Welcome Guest, Not a member yet? Register Sign In |