Miscellaneous Code
  Home arrow Miscellaneous Code arrow Inserting Database Records with a Code...
Codewalker Forums 
  Tutorials  
Database Articles  
Miscellaneous  
Navigation Usability  
PEAR Articles  
Programming Basics  
Server Administration  
XML Tutorials  
  Reviews  
Database Book Reviews  
Linux Book Reviews  
Miscellaneous Reviews  
PHP Book Reviews  
PHP Software Reviews  
Server Admin Reviews  
SQL Tool Reviews  
  Code Gallery  
Content Management Code  
Contest Code  
Counters Code  
Database Code  
Date Time Code  
Discussion Board Code  
Email Code  
File Manipulation Code  
GUI Code  
Link Farm Code  
Miscellaneous Code  
Search Code  
Site Navigation Code  
User Management Code  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Download TestComplete 
Forums Sitemap 
Weekly Newsletter 
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
MISCELLANEOUS CODE

Inserting Database Records with a CodeIgniter PHP Framework Model
By: Alejandros Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2009-09-02

    Table of Contents:
  • Inserting Database Records with a CodeIgniter PHP Framework Model
  • Review: fetching database rows with the generic model
  • Coding a method for inserting database records
  • The complete source code of the generic model class

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Inserting Database Records with a CodeIgniter PHP Framework Model


    (Page 1 of 4 )

    Welcome to the fourth part of an eight-part series that shows you how to build a generic model for the CodeIgniter PHP framework. In this part of the series, I code a new method for the generic model class which allows you to insert new records into the specified database table, as well as update an existing one. Keep reading for the full details.

    It’s not surprising that the CodeIgniter PHP framework has a large community of users. It comes packaged with a number of valuable features that make it appealing to many web developers: excellent online documentation (quite possibly its strongest point) and a flat learning curve, a solid set of classes and helpers, and finally, it allows developers to create web applications by using the Model-View-Controller pattern.

    However, there’s one feature lacking in CodeIgniter that's a detriment to its unquestionable quality. At the time of writing this article, it doesn’t provide a native ORM model. Of course, this issue can be easily fixed by picking up well-trusted third-party libraries like Simon Stensi’s DataMapper or IgniterRecord, since both of them come equipped with enough functionality to handle not only basic CRUD operations, but the most common types of relations between database tables (one-to-one, one-to-many, many-to-many, etc.).

    Even so, it’s also possible to develop a customized generic model for CI that permits you to quickly build PHP applications in a truly painless fashion. That's tje goal of this series of articles. So, if you’re interested in learning how to accomplish this in a few simple steps, then don’t hesitate anymore; begin reading now!

    Naturally, if you already went through the previous articles, it’s probable that at this time you have an approximate idea of how to create a generic model for CodeIgniter. And I’m saying this simply because in the earlier tutorials, not only did I create the bare bones structure of this model, but I provided it with some basic functionality, including the ability for fetching records from a specified database table according to certain conditions.

    Nonetheless, this generic model needs to be enhanced even more. Thus, with that premise in mind, in this fourth chapter of the series, I’m going to add another method to it, which will be responsible for inserting new records into the associated database table, thus extending its current functionality.

    So, are you ready to learn how this whole new method for the generic model of CodeIgniter will be coded? Then let’s get started!

    More Miscellaneous Code Articles
    More By Alejandros Gervasio


       · This part of the series shows how to add a new method to the generic model class...
     

    MISCELLANEOUS CODE ARTICLES

    - 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 ...
    - Model Data and Validation Rules for a Generi...
    - Building a Generic Model for the CodeIgniter...
    - upload image to database sql
    - Random Password Generator
    - BCroot, get the root of a number with BC fun...
    - Find pi in a high precision
    - [PHP5] FORMCHECKER : data validation
    - SPL and ITERATOR : examples
    - Xml with Rss Feeds





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek