Crud in codeigniter
The acronym CRUD means Create, Read, Update, and Delete. Any application that uses persistent data must have CRUD operations. The CRUD is an important thing that developers keep in mind…
The acronym CRUD means Create, Read, Update, and Delete. Any application that uses persistent data must have CRUD operations. The CRUD is an important thing that developers keep in mind…
http://localhost/codeigniter/ci3/index?id=3 (url) public function index() (controller) { $id = $_GET['id']; echo $id; die(); $arr['data'] = $this->WelcomeModel->index(); $this->load->view('pages/home', $arr); } http://localhost/codeigniter/ci3/index/4 public function index($id = 3, $name = 'homepage') { echo…
Model: defined('BASEPATH') OR exit('No direct script access allowed'); class WelcomeModel extends CI_Model { function index(){ $data = ['name' => 'Pankaj Kumar Loniya', 'age' => 28]; return $data; } } Controller:…
WelcomeModel .php (model): defined('BASEPATH') OR exit('No direct script access allowed'); class WelcomeModel extends CI_Model { function index(){ echo "about model"; } } Welcome.php (controller): defined('BASEPATH') OR exit('No direct script access…
url structure: base_url/controllername/functionname Remove controllername from url: /application/config/routes.php $route['default_controller'] = 'welcome'; $route['^(?!other|controller).*'] = 'welcome/$0'; $route['404_override'] = ''; $route['translate_uri_dashes'] = FALSE; Remove index.php from url: create .htaccess file at root directory…
<?php defined('BASEPATH') OR exit('No direct script access allowed'); class Welcome extends CI_Controller { public function index() { $this->load->view('header'); $this->load->view('index'); $this->load->view('footer'); } function about(){ $this->load->view('header'); $this->load->view('about'); $this->load->view('footer'); } } /* filename…
Creation of dynamic property CI_URI::$config is deprecated /system/core/URI.php #[\AllowDynamicProperties] class CI_URI { /system/core/Router.php #[\AllowDynamicProperties] class CI_Router { /system/core/Loader.php #[\AllowDynamicProperties] class CI_Loader { /system/core/Controller.php #[\AllowDynamicProperties] class CI_Controller { /system/database/DB_driver.php #[\AllowDynamicProperties] abstract…