Posts

Showing posts from October, 2024

views/edit_view File in CodeIgniter 3

Image
  <! DOCTYPE html > < html lang = "en" > < head >     < meta charset = "UTF-8" >     < meta name = "viewport" content = "width=device-width, initial-scale=1.0, shrink-to-fit=no" >     < meta http-equiv = "X-UA-Compatible" content = "ie-edge" >     < title > Edit View </ title >     < link rel = "stylesheet" type = "text/css" href = " <?php echo base_url (); ? > assets/css/bootstrap.min.css" > </ head > < body >     < div class = "jumbotron" >         < h1 align = "center" > CRUD CI APP </ h1 >     </ div >     < div class = "container" >         < h1 align = "center" > Edit Product </ h1 >         < form action = " <?php echo base_url (); ? > Crud/update/ <?php echo $singleProduct -> id ; ? > "...

views/crud_view File in CodeIgniter 3

Image
  <! DOCTYPE html > < html lang = "en" > < head >     < meta charset = "UTF-8" >     < meta name = "viewport" content = "width=device-width, initial-scale=1.0, shrink-to-fit=no" >     < meta http-equiv = "X-UA-Compatible" content = "ie=edge" >     < title > CRUD Operation in CodeIgniter </ title >     < link rel = "stylesheet" type = "text/css" href = " <?php echo base_url (); ? > assets/css/bootstrap.min.css" > </ head > < body >     < div class = "jumbotron" >         < h1 align = "center" > CRUD CodeIgniter Application </ h1 >     </ div >     < div class = "container" >         < div class = "clear-fix" >             < h3 style = " float: left" > All Products </ h3 >         ...

models/Crud_model File in CodeIgniter 3

Image
  <?php defined ( "BASEPATH" ) or exit ( "No direct script access allowed" ); class Crud_model extends CI_Model {     public function __construct ()     {         parent :: __construct ();     }     public function getAllProducts ()     {         $query = $this -> db -> get ( "products" );         if ( $query ) {             return $query -> result ();         }     }     public function insertProduct ( $data )     {         $query = $this -> db -> insert ( "products" , $data );         if ( $query ) {             return true ;         } else {             return false ;         }     }     public funct...

Crud Controller in CodeIgniter 3

Image
  <?php defined ( "BASEPATH" ) or exit ( "No direct script access allowed" ); class Crud extends CI_Controller {     public function __construct ()     {         parent :: __construct ();         $this -> load -> model ( "Crud_model" );     }     public function index ()     {         $this -> load -> model ( "Crud_model" );         $data [ "product_details" ] = $this -> Crud_model -> getAllProducts ();         $this -> load -> view ( "crud_view" , $data );     }     public function addProduct ()     {         $this -> form_validation -> set_rules ( "name" , "Product Name" , "trim|required" );         $this -> form_validation -> set_rules ( "price" , "Product Price" , "trim|required" );         $thi...