CONTACT @ Skype : rajdimdung   |   call : +977 9841813550

How to display records | data from database using framework?

Post by : Raj Dimdung    Date : 2014-12-23 06:25:27

Database Quick Start: Example Code

The following page contains example code showing how the database class is used. For complete details please read the individual pages describing each function.

Initializing the Database Class

The following code loads and initializes the database class based on your configuration settings:

$this->load->database();

Once loaded the class is ready to be used as described below.
Note: If all your pages require database access you can connect automatically. See the connecting page for details.

Standard Query With Multiple Results (Object Version)

$query = $thi 
					

Read More

Error Handling in CI Framework

Post by : Raj Dimdung    Date : 2014-12-21 03:11:27

CodeIgniter lets you build error reporting into your applications using the functions described below. In addition, it has an error logging class that permits error and debugging messages to be saved as text files.

Note: By default, CodeIgniter displays all PHP errors. You might wish to change this behavior once your development is complete. You'll find the error_reporting() function located at the top of your main index.php file. Disabling error reporting will NOT prevent log files from being written if there are errors.

Unlike most systems in CodeIgniter, the error functions are simple procedural interfaces that are available globally throughout the appli

Read More

Adding pagination class in ci framework

Post by : Raj Dimdung    Date : 2014-12-14 10:03:34

Pagination Class

CodeIgniter's Pagination class is very easy to use, and it is 100% customizable, either dynamically or via stored preferences. If you are not familiar with the term "pagination", it refers to links that allows you to navigate from page to page, like this:

Output

« First  < 1 2 3 4 5 >  Last »

Example

Here is a simple example showing how to create pagination in one of your controller functions:

$this->load->library('pagination');

$config['base_url'] = 'http://example.com/index.php/test/page/';
$config['total_rows'] = 200;
 
					

Read More

How to set database configuration in CI framework

Post by : Raj Dimdung    Date : 2014-12-10 09:06:12

Database Configuration

CodeIgniter has a config file that lets you store your database connection values (username, password, database name, etc.). The config file is located at application/config/database.php. You can also set database connection values for specific environments by placing database.php it the respective environment config folder.

The config settings are stored in a multi-dimensional array with this prototype:

$db['default']['hostname'] = "localhost";
$d 
					

Read More

Model View Controller(MVC) in PHP

Post by : Raj Dimdung    Date : 2014-12-02 07:44:27

The model view controller pattern is the most used pattern for today’s world web applications. It has been used for the first time in Smalltalk and then adopted and popularized by Java. At present there are more than a dozen PHP web frameworks based on MVC pattern.

Despite the fact that the MVC pattern is very popular in PHP, is hard to find a proper tutorial accompanied by a simple source code example. That is the purpose of this tutorial.

The MVC pattern separates an application in 3 modules: Model, View and Controller:

#1 The model is responsible to manage the data; it stores and retri

Read More