Archivio tag: code igniter

Tip: Use Code igniter methods without instance a class

Sometimes making a class in Code Igniter you could need to use some method of Code igniter (database class for examples) without instance the class itself, for example in static method.

In this case, you can use the Code Igniter instance itself:

$ci_ins =& get_instance();
$ci_ins->load->model("some model");
$ci_ins-->db->insert(); //Using database