Course Content
Introduction to CodeIgniter
CodeIgniter is a powerful PHP framework built for developers who need a simple and elegant toolkit to create full-featured web applications.
MVC (Model-View-Controller)
MVC stands for Model-View-Controller. MVC is an application design model consisting of three interconnected parts. They include the model (data), the view (user interface), and the controller (processes that handle input).
The Session class allows you to maintain a user’s "state" and track their activity while they browse your site.
URI Routing
There is a one-to-one relationship between a URL string and its corresponding controller class/method. The segments in a URI normally follow this pattern:
Forms and Input
Forms provide a way for users to interact with the application and submit data.
Composer is dependency manager in PHP. it allows you to declare the libraries your project depends on and it will manage (install/update) them for you.
You can enable CSRF protection by modifying your application/config/config.php file
Working with Database
Like any other framework, we need to interact with the database very often and CodeIgniter makes this job easy for us. It provides a rich set of functionalities to interact with the database.
DataTables is a table enhancing plug-in for the jQuery Javascript library that helps in adding sorting, paging, and filtering abilities to plain HTML tables with minimal effort. The main goal is to enhance the accessibility of data in normal HTML tables.
PhpSpreadsheet is a PHP library for reading and writing spreadsheet files. Importing Excel and CSV into MySQL help to save the user time and avoid repetitive work.
Payment Gateway
Razorpay and PayTM Payment Gateway
WhatsApp Chatbot and Telegram Chatbot
CodeIgniter 3
About Lesson

delete() method is used to delete data from the database.

The DELETE statement is used to delete records from a table:

DELETE FROM table_name
WHERE some_column = some_value

Note: The WHERE clause specifies which record or records that should be deleted. If you omit the WHERE clause, all records will be deleted!

1. Create a list.php file in applications/views/ directory

<table width="600" border="1" 
cellspacing="5" cellpadding="5">
	<tr style="background:#CCC">
		<th>Sr No</th>
		<th>Email Id</th>
	<?php $i=1; foreach($result as $row) { 
		echo "<tr>"; 
		echo "<td>".$i. "</td>"; 
		echo "<td>".$row->first_name."</td>";
		echo "<td>".$row->last_name."</td>"; 
		echo "<td>".$row->email."</td>"; 
		echo "</tr>"; $i++; } ?>
		echo "<td><a 
		href=”<?php echo base_url('user/delete'.$row->id); ?>”>

2. Create a model file User_model.php in the applications/models/ directory.

class User_model extends CI_Model {
	function list() {
		$query = $this->db->get();
		return $query->result();

	public function delete($id) {
		$where = [“id” => $id];
		return $this->db->delete(‘user_info’, $where);

3. Create a controller file User.php in the applications/controllers/ directory.

class User extends CI_Controller {

	public function __construct() {
		/*call CodeIgniter's default Constructor*/

		/*load model*/
	public function list() {
		$data[‘result’]	= $this->user_model->list();
		$this->load->view(‘list’, $data);

	public function delete($id) {
		$result = $this->user_model->delete($id);
		if($result) {
			echo “User record is deleted successfully.”;
		} else {
			echo “Something went wrong”;