Miscellaneous Code

  Home arrow Miscellaneous Code arrow Validating Input Data with the CodeIgn...
MISCELLANEOUS CODE

Validating Input Data with the CodeIgniter PHP Framework
By: Alejandros Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2009-09-16

    Table of Contents:
  • Validating Input Data with the CodeIgniter PHP Framework
  • Review: the complete source code of the generic model class
  • Adding validation capabilities to the generic model class
  • Listing the enhanced version of the generic model class

  •  
     

    SEARCH CODEWALKERS

    TOOLS YOU CAN USE

    advertisement

    Validating Input Data with the CodeIgniter PHP Framework


    (Page 1 of 4 )

    Welcome to the sixth installment of the series that shows you how to build a generic model for the CodeIgniter PHP framework. Made up of eight parts, this series walks you through the development of a simple model class for the CodeIgniter PHP framework. This class will allow you to retrieve, save and delete rows of a specified database table with minor hassles by using a truly straightforward programming interface, along with a few basic child models.

    And now that you've been introduced to the main goal of this series of articles, it’s time to review the topics that were covered in the last tutorial, in case you haven’t had the chance to read it yet. In that particular installment I proceeded to implement a new method within the already familiar “AbstractModel” class, called “save().” It came in handy for deleting rows from the model’s associated database table, thus providing the class with the ability to perform basic CRUD operations.

    Also, it’s valid to point out that from an average programmer’s point of view, the model class in its current incarnation should quite decently fill the requirements of most database-driven web applications. However, as I explained in previous articles, it’d be truly useful to give the class the capacity to validate input data before inserting and updating database records, thus avoiding the situation where the corresponding controllers replicate this task at several points of a PHP application.

    Therefore, in the next few lines I’m going to add another method to the “AbstractModel” class, which will be responsible for validating incoming data prior to performing inserts and updates on the specified database table. Want to learn how this method will be coded using the native resources of CodeIgniter? Then  start reading now!

    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 5 - Follow our Sitemap