[eluser]puzzlebox[/eluser]
I think it would be something like this:
$this->db->select('code,name')->from('country_ips')->join('country_codes')->where("$ip BETWEEN start AND end",NULL,FALSE);
reply if that doesn't work
SELECT `code`, `name` FROM `country_ips` NATURAL JOIN `country_codes` WHERE *IP_GOES_HERE* BETWEEN `start` AND `end`