Welcome Guest, Not a member yet? Register   Sign In
Helper or Model for DB functions ?

I want to use functions like this:

function get_default_language()
    $CI =& get_instance();
    $CI->db->select('language')->from('languages')->where('default', 1);
    $get = $CI->db->get()->row();
    return $get->language;

inside different models like pages, products, categories, etc.
I'm learning CI while developing online store.

Currently i'm using helpers, but is it ok with the concept of MVC/CI?.

Wich one is better and why?

If you are using the same methods over and over in different models then put them all in a helper!

Otherwise if they are just specific to that one model, then place them in that model.

Theme © iAndrew 2016 - Forum software by © MyBB