I have the following content in the field pro_are_id
: ["11","3"]
this content made with json_encode()
, I would like to query the database and know if this id
exists in specific or not, I tried this way:
$area = 1;
$this->db->like("pro_are_id", $area);
return $this->db->get('produto')->result();
The problem with this method is that it will return true, because there is 11, which contains the number 1 (id I am searching for).
What would be the correct way to get the result? Can not I just use WHERE?
Note: I am using codeigniter, but if the answer is in PHP, I can use it within CI guidelines.