Posts

Showing posts from July, 2024

View User File in CodeIgniter 3 in PHP

Image
  <! DOCTYPE html > < html lang = "en" > < meta charset = "UTF-8" > < meta name = "viewport" content = "width=device-width, initial-scale=1.0" > < link rel = "stylesheet" type = "text/css" href = " <?php echo base_url () . "assets/css/bootstrap.min" ; ? > " > < title > Crud Application - View Users </ title > < body >     < div class = "navbar navbar-dark bg-dark" >         < div class = "container" >             < a href = "#" class = "navbar-brand" > CRUD APPLICATION </ a >         </ div >     </ div >     < div class = "container" style = " padding-top: 10px;" >         < div class = "row" >             < div class = "col-md-12" >                 <?php   ...

Update User File in CodeIgniter 3 in PHP

Image
  <! DOCTYPE html > < html lang = "en" > < meta charset = "UTF-8" > < meta name = "viewport" content = "width=device-width, initial-scale=1.0" > < link rel = "stylesheet" type = "text/css" href = " <?php echo base_url () . "assets/css/bootstrap.min" ; ? > " > < title > Crud Application - Update User </ title > < body >     < div class = "navbar navbar-dark bg-dark" >         < div class = "container" >             < a href = "#" class = "navbar-brand" > CRUD APPLICATION </ a >         </ div >     </ div >     < div class = "container" style = " padding-top: 10px;" >         < h3 > Update User </ h3 >         < hr >         < form method = "post" name = "createUser" action = " <?php ec...

Create User File in Codeigniter 3 in PHP

Image
  <! DOCTYPE html > < html lang = "en" > < meta charset = "UTF-8" > < meta name = "viewport" content = "width=device-width, initial-scale=1.0" > < link rel = "stylesheet" type = "text/css" href = " <?php echo base_url () . "assets/css/bootstrap.min" ; ? > " > < title > Crud Application - Create User </ title > < body >     < div class = "navbar navbar-dark bg-dark" >         < div class = "container" >             < a href = "#" class = "navbar-brand" > CRUD APPLICATION </ a >         </ div >     </ div >     < div class = "container" style = " padding-top: 10px;" >         < h3 > Create User </ h3 >         < hr >         < form name = "createUser" action = " <?php echo base_url () . ...

User Model File in Codeigniter 3 in PHP

Image
  <?php defined ( "BASEPATH" ) or exit ( "No direct script access allowed" ); class User_model extends CI_Model {     public function create ( $formArray )     {         $this -> db -> insert ( "users" , $formArray ); //INSERT INTO users(name,email) VALUES(?,?);     }     public function allRecords ()     {         return $this -> db -> get ( "users" )-> result_array (); //SELECT * FROM users;     }     public function getUser ( $userId )     {         $this -> db -> where ( "user_id" , $userId );         return $this -> db -> get ( "users" )-> row_array (); //SELECT * FROM users WHERE user_id = ?     }     //UPDATE the record from Database     public function updateUser ( $userId , $formArray )     {         $this ->...

User Controller File in Codeigniter 3 PHP

Image
  <?php defined ( "BASEPATH" ) or exit ( "No direct script access allowed" ); class User extends CI_Controller {     public function __construct ()     {         parent :: __construct ();     }     public function index ()     {         $this -> load -> model ( "User_model" );         $data [ "users" ] = $this -> User_model -> allRecords ();         $this -> load -> view ( "list" , $data );     }     public function create ()     {         $this -> load -> model ( "User_model" );         $this -> form_validation -> set_rules ( "name" , "Name" , "required" );         $this -> form_validation -> set_rules ( "email" , "Email" , "required|valid_email" );         if ( $this -> form_validation -> r...