Skip to main content

Posts

Simple Pagination Using PHP and MySQLi

  Simple Pagination Using PHP and MySQLi Database CREATE TABLE `users` ( `name` varchar(250) NOT NULL, `age` varchar(250) NOT NULL, `department` varchar(250) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; db.php <?php $con = mysqli_connect("localhost","root","","users"); if (mysqli_connect_errno()){ echo "Failed to connect to MySQL: " . mysqli_connect_error(); die(); } ?> index.php <html> <head> <title>Create Simple Pagination Using PHP and MySQLi </title> <link rel="stylesheet" href="css/bootstrap.min.css"> </head> <body> <div style="width:700px; margin:0 auto;"> <h3>Simple Pagination Using PHP and MySQLi</h3> <table class="table table-striped table-bordered"> <thead> <tr> <th style='width:50px;'>ID</th> <th style='width:150px;'>Name</th> <th style='w...

Check Email availability using Ajax in CodeIgniter

  Check Email availability using Ajax in CodeIgniter Controller - Email_Controller.php <?php defined('BASEPATH') OR exit('No direct script access allowed'); class Email_Controller extends CI_Controller { //functions function index() { $data["title"] = "Codeigniter Tutorial - Check Email availibility using Ajax"; $this->load->view("email_availibility", $data); } function check_email_avalibility() { if(!filter_var($_POST["email"], FILTER_VALIDATE_EMAIL)) { echo '<label class="text-danger"><span class="glyphicon glyphicon-remove"></span> Invalid Email</span></label>'; } else { $this->load->model("main_model"); if($this->main_model->is_email_available($_POST["email"])) ...

detect-user-ip-browser-operating-system-details in CodeIgniter framework

  detect-user-ip-browser-operating-system-details in CodeIgniter framework Controllers  load->library('user_agent'); $data['browser'] = $this->agent->browser(); $data['browser_version'] = $this->agent->version(); $data['os'] = $this->agent->platform(); $data['ip_address'] = $this->input->ip_address(); $this->load->view('view', $data); } } ?> Views  <!DOCTYPE html> <html> <head> <title>How to Get User IP, Browser & OS Details in Codeigniter</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" /> </head> <body> <div class="container"> <br /> <h3 align="center" style="color:red;">How to Get User IP, Browser & OS Details in Codeigniter</h3> <br /> <div class="table-responsive"> ...

User Registration and Login & logout System in codeigniter

  User Registration and Login & logout System in codeigniter Controllers - Login.php <?php defined('BASEPATH') OR exit('No direct script access allowed'); class Login extends CI_Controller { public function index() { $this->load->view('login'); } function loginn() { $this->load->library("Session"); $email = $this->input->post('email',TRUE); $password = md5($this->input->post('password',TRUE)); $this->load->model('login_model'); $validate = $this->login_model->validate($email,$password); if($validate->num_rows() > 0){ $data = $validate->row_array(); $email = $data['email']; $password = $data['password']; $id = $data['id']; $name = $data['name']; $sesdata = array( 'email' => $email, 'password' => $password, ...

Get last insert id after insert query Code-igniter

function save_student() { $student_data=array( 'name'=>$this->input->post('name'), 'last_name'=>$this->input->post('last_name') ); $this->db->insert('student_db', $student_data); $insert_id = $this->db->insert_id(); return $insert_id; } insert_id() function will return zero if table does not have auto incremented column so make sure table must have a column with AUTO_INCREMENT attribute.

cloudconvert to convert file using curl php

<!DOCTYPE html> <html> <head>   <title>Project APi File Convert</title>   <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" >   <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> </head> <body> <form action="curl.php" method="POST" enctype="multipart/form-data">    <div class="container">    </br></br></br></br></br></br>      <div class="form-group">       <label>Select Input  Format</label>       <select class="form-control" name="inputformat">         <option>Select Format</option>         <option value="key">key</option>     ...

RESTful web services in codeigniter

Controller:-Api.php <?php require(APPPATH.'/libraries/REST_Controller.php'); class Api extends REST_Controller{         public function __construct()     {         parent::__construct();         $this->load->model('data_model');     }     function sdata_get()      {                 $result =$this->data_model->all_data();                 if($result)         {                         $this->response($result, 200);         }         else         {             $this->response("No record found", 404);         }               return js...