I have this bit that I’m using to search IP addresses in a database.
$this->db->where("IP1='$ip' OR IP2='$ip'");
When I use it, it is escaping the periods in the IP addresses and breaking the query by producing this.
SELECT * FROM (`xxxx`) WHERE `IP1='111`.`111`.`111`.`111'`
I want it to produce:
SELECT * FROM (`xxxx`) WHERE IP1='111.111.111.111' OR IP2 = '111.111.111.111'
Thank you!
From the documentation:
“
$this->db->where()accepts an optional third parameter. If you set it to FALSE, CodeIgniter will not try to protect your field or table names with back-ticks.”You better make sure that you are sanatizing your variables if you do it this way.