delete Query In Codeigniter Example Tutorial

Today, We want to share with you delete Query In Codeigniter Example Tutorial.In this post we will show you insert query in codeigniter, hear for codeigniter join query we will give you demo and example for implement.In this post, we will learn about Join Query In Codeigniter with an example.

List of all Google Adsense, VueJS, AngularJS, PHP, Laravel Examples.

delete Query In Codeigniter Example Tutorial

There are the Following The simple About delete query in codeigniter Full Information With Example and source code.

As I will cover this Post with live Working example to develop join query in codeigniter, so the join in codeigniter is used for this example is following below.

Codeigniter delete database record

codeigniter Delete method is used to remove/delete the one or more records data from MySQL database table. If We need to delete all the MySQL data from a Databse table, We can simple use the truncate() function, or onther methods like as a empty_table().

delete query in codeigniter
delete query in codeigniter
  • $this->db->delete()
  • $this->db->empty_table()
  • $this->db->truncate()
  • Delete With Join


$this->db->delete('tbl_client', array('member_id' => $member_id)); 
//DELETE FROM tbl_client WHERE member_id = $member_id

$this->db->where('member_id', $member_id);
//DELETE FROM tbl_client WHERE member_id = $member_id

simple pass An array of Dataabse table names can be argument passed into delete() function if you would like to simple database table to delete data from multiple table.

$tables = array('member', 'team', 'category');
$this->db->where('member_id', $member_id);


// DELETE FROM tbl_client


// TRUNCATE table tbl_client;

Delete With Join

$this->db->join("team", "member.t1_member_id = team.t2_member_id");
$this->db->where("team.t2_member_id", $member_id);

Example 1: Codeigniter delete database record


class Pakainfo extends CI_Controller 
	public function __construct()

	public function savedata()
	public function dispdata()
	public function deletedata()


<!DOCTYPE html>
<title>Display Records -</title>

<table width="600" border="1" cellspacing="5" cellpadding="5">
  <tr style="background:#CCC">
    <th>Sr No</th>
    <th>client Name</th>
    <th>client Email</th>
    <th>client Phone</th>
	<th>client Delete</th>
  foreach($data as $client)
  echo "<tr>";
  echo "<td>".$i."</td>";
  echo "<td>".$client->name."</td>";
  echo "<td>".$client->email."</td>";
  echo "<td>".$client->phone."</td>";
  echo "<td><a href='deletedata?id=".$client->client_id."'>Delete</a></td>";
  echo "</tr>";


class Pakainfo_Model extends CI_Model 
	function saverecords($name,$email,$phone)
		$query="insert into clients values('','$name','$email','$phone')";
	function displayrecords()
		$query=$this->db->query("select * from clients");
		return $query->result();
	function deleterecords($id)
		$this->db->query("delete  from clients where client_id='".$id."'");

Codeigniter (CRUD) Select Insert Update Delete Query

  1. Update Query In Codeigniter
  2. Select Query In Codeigniter
  3. Insert Query In Codeigniter
  4. Delete Query In Codeigniter
Web Programming Tutorials Example with Demo

Read :


You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about select query in codeigniter.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Related FAQ

Here are some more FAQ related to this Article:

  1.   select Query In Codeigniter Example Tutorial
  2.   Multiple file Upload in Laravel 5.7 with validation
  3.   insert Query In Codeigniter Example Tutorial
  4.   Update Query In Codeigniter Example Tutorial
  5.   Codeigniter delete query from Database
  6.   PHP Get Current URL Full Path HTTP-HTTPS Protocol
  7.   PHP If Else Switch Case Conditional
  8.   Angularjs Pass Multiple Parameters to Pipe
  9.   Update query in codeigniter Example
  10.   Laravel Application Directory Structure Example

Leave a Reply

Your email address will not be published. Required fields are marked *