I have a model created 'Knowledge Base Articles' and have chucked loads of dummy articles into the database. I want to show 5 per page, with query parameters for 'tag' and 'page' with pagination buttons Previous and Next.
One of the fields in the database has a comma separated list of strings in it surrounded by square brackets, i.e a JSON string, e.g. ["home", "travel", "bike", "car"]
And then I have a code fragment:
$limit = 5;
$offset = ($_GET['page']-1) * $limit;
$query = array('find' => 'all', 'limit' => $limit, 'offset' => $offset);
$articles = fuel_model('knowledge_base_articles', $query);
I want to be able to check if $_GET['tag'] i.e. car, bike, pet etc.. is IN the JSON string. How do I incorporate an SQL IN statement into the original query?