![]() |
I need to work with json data in mysql column. So,I've written the mysql query(for instance JSON_EXTRACT method) like this:
PHP Code: $query = $this->db->query("select * FROM articles WHERE JSON_EXTRACT(`status` , '$.\"1\".\"is_delete\"') > 0")->getResultObject(); In action, this work truly. Now, I need to change my query to Query Builder Class like this: PHP Code: $builder = $this->db->table('articles')->select('*')->where('status > ', "JSON_EXTRACT(`status` , '$.\"1\".\"is_delete\"')"); In action, in query builder class, my query doesn't work truly. what's wrong with query builder class?! How to work with the query builder class in this case?!
@superior
Sure, I knew. But both of them have had a bug(table alias name) in CI4 +. I need to add mysql table name alias, after that, string or RawSQL doesn't work. For instance: PHP Code: $whereClause = "JSON_EXTRACT(`artl.status` , '$.\"1\".\"is_delete\"') > 0"; Now we see this error and CI4 can't find the column: Code: Unknown column 'artl.status' in 'where clause'
Look at the quotes in your where caluse.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |