I have an SQL query which I'm adding to a small search plugin, however when I run the SQL in MySQL it works and results are found, however no rows are being returned when running the code in the plugin. Any ideas?
$query = ee()->db->query('
SELECT c.cat_url_title, c.cat_name, ch.channel_name FROM exp_categories c
LEFT JOIN exp_channels ch ON ch.cat_group = c.group_id
WHERE c.cat_name LIKE "%' . ee()->db->escape_str($keywords) . '%"
');
UPDATE (moved from further answer) Thanks. I was being thick! the query was working correctly. I was sending it the wrong parameter