php - Weird Codigniter query escaping -


issue string in active record statement gets escaped when string contains combination of words 'or' , 'like'. here code use

$this->db->select('id'); $this->db->where('phrase', $phrase); $this->db->from('phrases'); $ret    = $this->db->get(); 

this works normal strings fail when $phrase encounters string 'click on event or booking code use.' 'or' , 'like' present words.

resulting query like

select `id` `phrases` `phrase` = 'click on event or `booking code you` `would` use.' 

i can't disable escaping comes handy other strings.

i think need add third parameter clause escape values.

$this->db->select('id'); $this->db->where('phrase', $phrase, false); $this->db->from('phrases'); $ret    = $this->db->get(); 

from manual:

where($key[, $value = null[, $escape = null]])

parameters:
$key (mixed) – name of field compare, or associative array

$value (mixed) – if single key, compared value

$escape (bool) – whether escape values , identifiers

more info in post on stack overflow.


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -