CodeIgniter Forums

Full Version: query builder %LIKE%
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, just tried the query builder on CI 3.1.10

$query = $this->db->get('element');
return $query->result();

gives blank array even there are rows matching in the database.

it returns nothing, upon checking the get_compiled_select()
it only produces

select *

if i put an error on the table_name 
it gives the right query but of course with the wrong table that i placed

SELECT * FROM `elements` WHERE `element_name` LIKE '%home%' ESCAPE '!'

and if i run the corrected statement(removing the 's' in table name in mysql, it does have rows.


What is your system configuration? PHP version? Database version? Any reason why you didn't upgrade to CI 3.1.11?

Have you tried it with adding this statement prior to your like statement: $this->db->select('*');

Have you tried Query binding (