PHPEveryday.com PHP and Web Development Tutorial
What are you looking for?


Table of Content
Learn CodeIgniter Framework Tutorial

Learn CodeIgniter Basic
CI Framework
CI Installation
CI MVC
CI Parameter
CI GET
CI Database Config
CI Database
CI Show All Data
CI Show a Data
CI GET Data

Learn CodeIgniter Form
CI Skeleton
CI Structure
CI Layout
CI Menu
CI Text
CI Centralizing
CI CSS
CI HTML
CI Form Code
CI HTML Style
CI Table
CI Insert Data
CI Table Library
CI Table List
CI URL Helper
CI Single Data
CI Form Parameters
CI Updating Data
CI Deleting Data
« CodeIgniter - Form: Updating Data AJAX - Client Side: Techniques Introduction »

CodeIgniter - Form: Deleting Data


CodeIgniter Form Step By Step Tutorial - Part 19: We have created link for delete data at data list. Now, we create deleting function.

First, create a function for deleting data at model.

  function delete($id){
    $this->load->database();
    $this->db->delete('books', array('id' => $id)); 
  }

Then, create a function for deleting data at controller:

  function del($id){
    $this->load->library('table');
	$this->load->helper('html');	
	$this->load->model('books_model');
	
	if((int)$id > 0){
  	  $this->books_model->delete($id);
	}
	
	$data = $this->books_model->general();
	$data['query'] = $this->books_model->books_getall();
		
	$this->load->view('books_main',$data);    
  }
CodeIgniter form delete data


Series this article:
CodeIgniter - Form: Creating Skeleton
CodeIgniter - Form: File Structure
CodeIgniter - Form: Creating Layout Code
CodeIgniter - Form: Creating Menu Library
CodeIgniter - Form: Putting Text at Header and Footer
CodeIgniter - Form: Centralizing $data
CodeIgniter - Form: Adding CSS
CodeIgniter - Form: Creating Form HTML
CodeIgniter - Form: Creating Beautiful Form Code
CodeIgniter - Form: CodeIgniter HTML Style
CodeIgniter - Form: Preparing Table at Database
CodeIgniter - Form: Creating Insert Data
CodeIgniter - Form: Creating List Data Use Table Library
CodeIgniter - Form: Creating Table List Without Table Library
CodeIgniter - Form: Using URL Helper
CodeIgniter - Form: Showing Single Data for Form Edit
CodeIgniter - Form: Something Happen With Form Parameters
CodeIgniter - Form: Updating Data
CodeIgniter - Form: Deleting Data


Tag: CodeIgniter, framework, MVC, database, delete, data Category: PHP Framework Post : March 03rd 2008 Read: 7,457 Bookmark and Share

blog comments powered by Disqus


Database Tutorial
  • Learn PHP MySQL
  • Learn PHP ADOdb
  • Learn PHP Data Object/PDO
  • Learn PHP XML
  • Learn PHP SimpleXML
Security Tutorial
  • Learn PHP Security
  • Learn HTTP Authentication
  • Learn PHPSecureSite
Framework Tutorial
  • Learn CodeIgniter
  • Learn Joomla
  • Learn Smarty
  • Learn Zend Framework
Template Tutorial
  • Learn Joomla Template
  • Learn WordPress Template
API Tutorial
  • Learn Facebook
JS Framework Tutorial
  • Learn MooTools
  • Learn JQuery
AJAX Tutorial
  • Learn AJAX in 10 Minutes
  • Learn AJAX Client Side
  • Learn AJAX PHP
  • Learn AJAX Remote Server
  • Learn AJAX Repetitive
  • Learn AJAX MySQL
  • Learn AJAX Grid
Web Services Tutorial
  • Learn Web Services NuSOAP
  • Learn Web Services WSDL
  • Learn Web Services WSDL Array
  • Learn Web Services .NET Grid
  • Learn Web Services WDDX
Package Post
  • Joomla Intro
  • Joomla Component
  • Joomla Module
  • Joomla MVC
  • Joomla MVC Backend
  • PostNuke Intro
  • Zend Framework Intro
  • Zend Framework Action
  • Zend Framework Database
  • Zend Framework Registry
  • Zend Framework Config
  • Zend Framework Login
  • Zend Framework Session
  • PHP Array Tips
  • PHP File Tips
  • PHP Email
  • PHP Ms Excel
  • PHP Pattern
  • PHP SMS
  • Flash Database
  • PHP Multitier
  • jQuery Introduction
  • jQuery Selectors
  • Portable Web Server
  • Web Mobile Intro
  • Drupal Installation
  • Drupal Configuration