News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

DevShed:
Defining a Model Class for Handling Views with CodeIgniter
April 24, 2009 @ 08:46:45

DevShed has posted the next article in their "Introduction to CodeIgniter" series today. This new tutorial, the sixth in the series, looks at reworking their example to use a model instead of a direct connection to the database.

You'll recall that I developed a sample PHP application. It displayed the contents of some database rows which were previously fetched from a "users" MySQL table. Moreover, these rows were retrieved by using the active record class bundled with CI. However, it's also possible to define a model that performs all of the database-related operations, instead of directly using the database class.

They create a simple User_model class that loads in the database functionality and, using that object, makes a select (get) to retrieve all user information in one method and select information in another. CodeIgniter "automagically" knows to pull from the Users table based on the naming convention of the file and class.

0 comments voice your opinion now!
database view framework codeigniter tutorial class model


blog comments powered by Disqus

Similar Posts

PHP Thinktank Blog: MVC with Abraxas

Klaus Graefensteiner's Blog: Getting Wordpress installed in a jiffy on Windows 7 using the WPI

PHP-GTK Community Site: Accessing geo-nick with Zend Framework (Zend_XmlRpc_Client)

Nik Chankov's Blog: 10 reasons to choose CakePHP as Framework

Sameer Borate: Calculating descriptive statistics in MySQL


Community Events





Don't see your event here?
Let us know!


voicesoftheelephpant library symfony bugfix language package introduction framework install community api deployment release podcast tips list series opinion laravel interview

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework