ICTtask works best with JavaScript enabled.

 

CodeIgniter AJAX CRUD using Bootstrap Modal Edit or Update

Live Demo
post thumbnail
Source Code
Hi there, In this tutorial we discuss about how can CodeIgniter AJAX CRUD using Bootstrap Modal-Edit or Update. First we fech single row data by row ID so go to write jquery code when click on edit button then we fetch data and show data on form field. We use ajax request now create a method into our controller and pass update row's id by ajax then will fetch data json type. Then ajax call back function will get json type row's data then we show data on form field now we change our form action hidden field value create to update. When submit form then checking empty field and image file format so We have already created functionality our previous tutorial so now we can use this just change action hidden field value create change to update. When submit form then we will send data by ajax request and we will create a method into our model for write update query by using codeigniter update query method. we have seen not only how can you update data from mysql Database even you can learn how to update image file from folder path by using Ajax Response Without page Refresh. Any problem We have also provide source code or see please in this tutorial. 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 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)