Crud Codeigniter 3

Set Up Codeigniter 3

  • Set up database
    1. Go to folder config
    2. Go to file database.php
    3. Set password to root
    4. Set database name
config/database example code
  • Set up config/autoload.php
    1. Go to config folder
    2. Go to autoload file
    3. Set autoload for libraries
    4. Then set autoload for helper
example for autoload[‘libraries’]
example for autoload[‘url’]
  • Remove index.php
    1. In the project folder add .htaccess file
    2. Then add code like example at file .htaccess
    3. Then go to config folder & go to config.php
    4. Remove index.php at config index page
.htaccess example
config index page example
  • Set base url
    1. Go to config folder
    2. Then go to config.php file
    3. Set url for base url
example config[‘base_url’] tutorial is project folder name
  • Add models file
    1. Go to applications
    2. Then go to models and add model file
    3. Can add function get list for query all data in the table
    4. Then add function get for query one row data in the table get data by id
    5. Add function insert for insert data in the table
    6. Add function update for update data in the table
    7. Add function delete for delete data in the table
example code for model file
  • Add controller
    1. Go to applications
    1. Then, go to controllers and add controller file
    2. Can load model u already added
    3. After that, add function listing for list all data from database
    4. Besides, add function add for display form for user
    5. Then, add function add_process for insert data in database after user fill the input
    6. Then add function update for user update data in database get data by id for value input in form
    7. Add function update_process for update data in database
    8. Add function delete for user delete data in database
example controller code
  • Add view
    1. Add view for list & form
example code list
example code form

Join the Conversation

1 Comment

Leave a comment

Leave a Reply to melbet-pakistan Cancel reply

Your email address will not be published. Required fields are marked *