[eluser]rudejason[/eluser]
I have only started using Codeigniter and i love it!
I have found that in my controllers i am using the same functions over and over. So i thought build a custom library and then i can use that.
here is my code
Code:
class Mygeodata
{
var $CI;
function Mygeodata()
{
$CI =& get_instance();
$CI->load->database();
}
function get_countries()
{
$query = $this->CI->query('SELECT `con_id`,`name` FROM `vb_geo_countries` ORDER BY `name`');
foreach($query->result() as $row)
{
$country_list .= '<option value="' . $row->con_id . '">' . $row->name . '</option>';
}
return $country_list;
}
when i run this it gives me this error...
Call to a member function query() on a non-object
what am i doing wrong?
Thank you in advance!