Welcome Guest, Not a member yet? Register   Sign In
query builder %LIKE%
#1

Hi, just tried the query builder on CI 3.1.10

$this->db->like('element_name',$var);
$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.

anyone?
Reply
#2

@notkapier,

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 (https://codeigniter.com/user_guide/datab...y-bindings)?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB