Book Image

CodeIgniter Web Application Blueprints

Book Image

CodeIgniter Web Application Blueprints

Overview of this book

Table of Contents (16 chapters)
CodeIgniter Web Application Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating the model


There is only one model in this project—signup_model.php that contains functions that are specific to adding a subscriber to the database, amending their settings and processing the removal of a subscriber should they unsubscribe.

This is our one and only model for this project. Let's briefly go over each function in it to give us a general idea of what it does, and then we will go into more details of the code.

There are four main functions in this model, which are as follows:

  • add(): This accepts one argument: the $data array sent by the signup controller's index() function when a user successfully submits the form in views/signup/signup.php. The add() function takes the array and using the $this->db->insert()CodeIgniter Active Record function, it inserts the user's signup data in the signups table.

  • edit(): This accepts one argument: the $data array sent by the signup controller's settings() function. This function is called only if the user is editing their settings...