Miscellaneous Code

  Home arrow Miscellaneous Code arrow Deleting Database Records with the Cod...
MISCELLANEOUS CODE

Deleting Database Records with the CodeIgniter PHP Framework
By: Alejandros Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 3
    2009-09-09

    Table of Contents:
  • Deleting Database Records with the CodeIgniter PHP Framework
  • Review: selects, inserts and deletes with the previous generic model
  • A new method for deleting database rows
  • The enhance version of the AbstractModel class

  •  
     

    SEARCH CODEWALKERS

    TOOLS YOU CAN USE

    advertisement

    Deleting Database Records with the CodeIgniter PHP Framework


    (Page 1 of 4 )

    Regardless of its remarkable features, including its outstanding online documentation, a flat learning curve and a strict application of the Model-View-Controller pattern, the CodeIgniter PHP framework still lacks an important characteristic that other competitors have already implemented in the form of native libraries. In this eight-part series, of which this is the fifth, we go some way toward remedying this oversight.

    Yes, as you might have guessed from this article’s title, in this case I’m talking about the existence of a generic model class that lets developers perform CRUD operations in database tables by means of a unified API. Of course, this lack isn’t as bad as it seems at first sight; there are some third-party model libraries like DataMapper and IgniterRecord, to cite the most popular ones, that can be seamlessly integrated with CodeIgniter.

    However, if you’re interested in learning how to build your own generic model class for CI, then in this group of articles you’ll find a comprehensive guide that will teach you in a step-by-step fashion how to build such a class. This hopefully will contribute to speeding up the development of web applications using this popular PHP framework.

    Of course, if you’ve been a patient reader and already went through the previous articles of the series, then at this point you have a reasonable idea of how to create a simple generic model for CodeIgniter. In the aforementioned tutorials I built an abstract class that was capable of fetching and inserting/updating records in a specified database table.

    Admittedly, this class in its current state has a limited functionality. It's necessary to add another method to it that allows you to delete records as well. Therefore, with that idea in mind, in this firth installment of the series, I’m going to define and implement a whole new method called “delete(),” which will perform deletions against a specified database table.

    Now, it’s time to see how to give the generic class developed in previous articles the ability to remove database records. Let’s jump in!

    More Miscellaneous Code Articles
    More By Alejandros Gervasio

    blog comments powered by Disqus

    MISCELLANEOUS CODE ARTICLES

    - Creating a Web Page Controller with the HMVC...
    - Coding Controllers and Views for the HMVC De...
    - A Sample Web Application with the HMVC Desig...
    - Adding a Class to Parse Views to an HMVC Des...
    - Building a Model Class for the HMVC Design P...
    - Filtering Input Data and Generating HTML For...
    - The HMVC Design Pattern: Working with MySQL ...
    - Dispatching Requests to MVC Triads with the ...
    - Implementing the Hierarchical Model-View-Con...
    - A Web App Based on a Model for the CodeIgnit...
    - Completing a Model for the CodeIgniter PHP F...
    - Validating Input Data with the CodeIgniter P...
    - Deleting Database Records with the CodeIgnit...
    - Inserting Database Records with a CodeIgnite...
    - Fetching Database Rows with a Model for the ...


    © 2003-2012 by Developer Shed. All rights reserved. DS Cluster 11 - Follow our Sitemap