CodeIgniter Basic – Calling model or database from views

Okay, this tips might be not the best practice to do because model should be called from controllers and database should be called from models (as per MVC guidelines). But, if you are no web-designer (like me) and in a hurry to test something inside your view files that involve database queries, this tips should suffice your need.

You can’t simply call models (or database) from your view files like this:

Instead, you should do like these examples:

I hope by examining those example, everything is clear.

Leave a Reply

%d bloggers like this: