PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, February 8, 2022

[FIXED] How to find out if variable value in database json column Codeigniter?

 February 08, 2022     codeigniter, json, mysql, php, sql     No comments   

Issue

Im using Codeigniter. Im trying to get some value in database like;

$this->db->where('json_value','test1');

the problem is 'json_value' column is like = [{"name":"test1","value":"test1"},{"name":"test2","value":"test2"}]

how can I get 'test1' if 'json_value' has?


Solution

You can use LIKE in your query

$this->db->like('json_value', 'test1', 'both');

For more information read the CI3 documentation.



Answered By - mail2bapi
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing