In this example, we will see how to use a CI model. For this example, we will use a model that performs these operations on the database: SELECT
, INSERT
, and UPDATE
.
The example displays, all the products that are retrieved by the model productmodel
at the main page in the database.
Let us assume the URI to the project root is http://mydomain.com/myproject
and http://mydomain.com/myproject/product
.
The main page has links for adding and editing a product. These links generate a form for editing and adding a product.
Let us assume the URI to the project root is http://mydomain.com/myproject
and http://mydomain.com/myproject/product/add
.
Suppose we want to edit and update the product with product_id 1
, the link will be http://mydomain.com/myproject/product/edit/1
. This example will be constructed from the following controller, model, and views:
application/controllers/product.php
: This controller loads the model product...