1.

Explain how to create custom 404 page in CodeIgniter?

Answer»

You can create your custom 404 page with these steps. Please follow these steps one by one.

 

  • You have to update your own created CONTROLLER's class with $route['404_override'] = 'Controller_Class_Name';. You have to update this in your application/config/routes.php
  • Please create your new controller "Controller_Class_Name" file in your controllers directory application/controllers/.
  • Please put this code in your Controller_Class_Name.php

    class Controller_Class_Name extends CI_Controller {
         public function __construct() {
              parent::__construct();
         }

        public function index() {
             $this->output->set_status_header('404');
             $this->LOAD->VIEW('error_page_404');
        }
    }
  • Now create your "error_page_404" view file.
29. How to INSERT data into database in codeigniter?

You can use $this->db->insert(); to insert data in your database in Codeigniter.

Also Read: SYMFONY interview questionsExample

If you want to insert this in your "Admin Table".

$dataArray = array(
       'name'=>'bestinterviewquestion.com',
       'phone'=>'9971083635',
       'email'=>'[email protected]'
);

$this->db->insert('Admin',$dataArray);

// Here "Admin" is My TableName



Discussion

No Comment Found