Here is my model
public function getDetails($ip)
{
$this->db->select('country_code, country_name');
$this->db->where("'2323' BETWEEN begin_ip_num AND end_ip_num");
return $this->db->get('ip')->row();
}
I get this error:
Unknown column ''2323'' in 'where clause'
SELECT `country_code`, `country_name` FROM (`ip`) WHERE `2130706433` BETWEEN begin_ip_num AND end_ip_num
Where I`m wrong ?
2323is evaluated as a column name, andbegin_ip_numandend_ip_numas values. You must do the opposite, like this :See MySQL Reference on ‘BETWEEN’ for how this should be used.