Showing posts from October, 2015

DataTables to display MySQL table using CodeIgnitor : Part 1

This blog is 2 part tutorial to help you to display MySQL data  using Codeignitor. Previously, before MVC, I use to write loops and pagination of tables from scratch. I use to do that on java in 11th class in my school day. I learnt loop from my teacher but I learnt pagination on my own. Now a days javascripts have arrived that can perform the server side processing. is the way to go if you have table with small amount of rows. Thus server side pagination by CodeIgnitor can be ignored. However, when it comes to editing and displaying huge sets of data, it is better to have because it is design with efficient server side processing and also editing in DataTables is only trial based.

Difference between jTable and DataTables is in the way they deal with HTML data. jTable just requires a DIV to be assigned and jquery and PHP does the rest whereas in DataTables you simply generate a standard HTML table which is later converted into pagination.

This is the Part 1 …

MySQL insert with HTML Form using CodeIgnitor

Using Core PHP, you can submit form and insert row in MySQL table using a single file. However, the method can be insecure. Using MVC model of CodeIgnitor, you can create a secure method. I can think of simple 1 php page form in an instance but my head hurts when implementing it on MVC model. So, here is tutorial for everyone including myself. The tutorial begins with basic step considering you have already installed WAMP or LAMP and unzipped codeignitor.
Configure connection to database in application/config/database.php. $db['default'] = array( 'dsn' => '', 'hostname' => 'localhost', 'username' => 'root', 'password' => 'password', 'database' => 'databasename', Add database library to application/config/autoload.php $autoload['libraries'] = array('database'); Create a model to insert data in MySQL in /application/models/Insert_model.php <?php class Insert_…

Create Login System with CodeIgniter MVC Model

Hello, I am a Core PHP programmer and currently learning MVC with codeigniter and bootstrap. So, don't expect some expert level stuff. So Let Begin.

What the hell is MVC?
I am not a reader as I want to code quickly, Here is a diagram to help us understand

After understanding the image, it can be presumed that HTML stuff will go to View section. Controllers will be our PHP scripts and boring databases will be in model section. Currently I am using Apache server in WAMP. If I am using MVC, I don't want to use it on simple website. Why should I give myself an headache to adopt it on a simple website? Hence, I am going to use it to create a login system for my own web interface.The framework will create a login system to make my data secure and easily manage of code. I am developing this on version 3.0.2 and this tutorial may not work in later version changes. Here are Simple steps to follow:

Download Codeigniter and unzip it in respective www folder. Thats it. I myself though it …