ICTtask works best with JavaScript enabled.

 

CodeIgniter AJAX CRUD using Bootstrap Modal - Delete

Live Demo
post thumbnail
Source Code
Hi every one, Our previous tutorials we have insert,select,upadte so now In this tutorial we discuss about how can CodeIgniter AJAX CRUD using Bootstrap Modal-Delete and Delete image file from folder. When click delete button then we will show confirm alert useing sweet alert. Now need delete row ID we will get row from button data attribute value then send row id by useing ajax request to controller method. Then we create a method into our model class for delete query. we will write delete query by useing codeigniter delete method. When successfull delete then we return a string and at the asme time ajax call back response get this string and will be show alert. When succssfull delete row from table same time unlink image file from upload folder. then do this and Fellow our video tutorial We have also provide youtube Video in this post. So Dear, friend please share this my youtube video, subscribe my youtube channel and share this post with your friends. Thanks Next Tutorilas Link these:
    Files structure Fellow:
  • Application root folder
    • aplication/controllers/CI_crud.php
    • //This file is controller class
    • aplication/models/Crud_m.php
    • //This file is model class
    • aplication/views/ci_crud.php
    • // view page

Sourse Code:

  • CI_crud.php - Controller class

  • <
    
  • Crud_m.php - Model class

  • <?php 
      /**
      * 
      */
      class Curd_m extends CI_Model
      {
    
        public function deleteDeveloper($table,$delteBtnId){
          $this->db->where('id',$delteBtnId);
          $result = $this->db->delete($table);
          return $result;
        }
        public function createAccount($table,$data){
          $result = $this->db->insert($table,$data);
          return $result;
        }
        public function getLoadData($table){
          $this->db->select('*');
          $this->db->from($table);
          $this->db->order_by('id','desc');
          $result = $this->db->get()->result();
          return $result;
        }
    
        public function getFetchSingleRow($table,$editBtnId){
          $this->db->where('id',$editBtnId);
          $result = $this->db->get($table);
          return $result->result();
        }
    
        public function updateAccount($table,$data,$updateId){
          $this->db->where('id',$updateId);
          $result = $this->db->update($table,$data);
          return $result;
        }
    
      }
    ?>
     
    
  • ci_crud.php view page

  • 
    
  • Database file sql

  • 
    --
    -- Database: `developers`
    --
    
    -- --------------------------------------------------------
    
    --
    -- Table structure for table `tbl_developers`
    --
    
    CREATE TABLE `tbl_developers` (
      `id` int(11) NOT NULL,
      `image` varchar(255) NOT NULL,
      `sex` varchar(255) NOT NULL,
      `name` varchar(255) NOT NULL,
      `email` varchar(255) NOT NULL,
      `skill` varchar(255) NOT NULL
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    
    --
    -- Dumping data for table `tbl_developers`
    --
    
    INSERT INTO `tbl_developers` (`id`, `image`, `sex`, `name`, `email`, `skill`) VALUES
    (5, '6057.jpg', '1', 'Elizabeth N. Bradleyjj', 'Elizabeth@gmail.com', 'python Developer'),
    (6, '23058.jpg', '1', 'Bradley', 'Bradley@gmail.com', 'PHP Developer'),
    (9, '1381.jpg', '2', 'Ruhi', 'ruhi@gmail.com', 'PHP AND JAVA'),
    (10, '3737.png', '1', 'Imrul', 'imrul@gmail.com', 'Python,php'),
    (11, '3819.png', '1', 'kobir', 'kobir@gmail.com', 'Java, C#'),
    (12, '13766.jpg', '1', 'Fahim Ali', 'fahimislam@gmail.com', 'Java'),
    (13, '18438.png', '2', 'Victoria sun', 'victoria.sun@gmail.com', 'Python, Javascript, jQuery'),
    (14, '15604.jpg', '1', 'Programmer Rayhan Mondol', 'icttask.com.rayhan@gmail.com', 'PHP, JAVA, Javascript, Jquery');
    
    --
    -- Indexes for dumped tables
    --
    
    --
    -- Indexes for table `tbl_developers`
    --
    ALTER TABLE `tbl_developers`
      ADD PRIMARY KEY (`id`);
    
    --
    -- AUTO_INCREMENT for dumped tables
    --
    
    --
    -- AUTO_INCREMENT for table `tbl_developers`
    --
    ALTER TABLE `tbl_developers`
      MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;
    /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
    /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
    /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
    
    

    Browse by Category

    php Ajax jQuery Codeigniter html css javascript

    Hi there! I am Rayhan Mondol, a PHP & JAVA Developer and ICT task is my programming blog. I'm fond of developing modern web applications. Contact me, I accept the paid task

    Latest Article

    post thumbnail

    Ajax Shopping Cart Customer Order View & account Update by using PHP OOP PDO(E-Commerce website-part 10)

    post thumbnail

    customer accout logout by using PHP OOP, PDO,COOKIE,AJAX(E-Commerce website-part 9)

    post thumbnail

    Customer Account Login by using PHP OOP PDO,AJAX (E-Commerce website-part 8)

    post thumbnail

    Customer Account Create by using PHP OOP PDO (E-Commerce website-part 7)

    post thumbnail

    Remove product from cart by using PHP OOP PDO(E-Commerce website-part 6)

    post thumbnail

    Ajax Shopping Cart update or Edit by using PHP OOP PDO (E-Commerce website-part 5)

    post thumbnail

    Ajax Shopping Cart View and calculate by using PHP OOP PDO (E-Commerce website-part 4)

    post thumbnail

    Drag and Drop Product Add to Cart by using PHP OOP PDO Ajax Jquery - E-Commerce project- (part-3)

    post thumbnail

    Product Add to Cart using PHP OOP PDO Ajax JQuery - E-Commerce project- (part-2)

    post thumbnail

    Create Dynamic Tabs using PHP OOP PDO - E-Commerce project- (part-1)

    post thumbnail

    CodeIgniter AJAX CRUD using Bootstrap Modal - Delete

    post thumbnail

    CodeIgniter AJAX CRUD using Bootstrap Modal Edit or Update

    post thumbnail

    CodeIgniter AJAX CRUD using Bootstrap Modal Read or view

    post thumbnail

    CodeIgniter AJAX CRUD using Bootstrap Modal-Create

    post thumbnail

    CodeIgniter AJAX CRUD(setup removing index.php from url)