How to use MySQL FIND_IN_SET() Function in Codeigniter
Last Modified at 2019-06-30 17:21:15
Today, I am going to share a very small but useful tutorial with you about how to use MySQL FIND_IN_SET() function in codeigniter. Let's say, you are creating a product listing page and the tag ids associated with the product are stored in a comma separated column and you want to fetch all records of tag id 5, in this case we use MySQL FIND_IN_SET() function.
Now the question is how to use FIND_IN_SET() function in Codeigniter?
Without wasting your time lets quickly walk through the code:
$this>db->select('name')->from('product')->where("FIND_IN_SET('5',post_tags) > 0")->get()->result();