Posted inProgramming / Codeigniter / Mysql / Mysqli / php

PHP Codeigniter load data while Ajax Infinite scrolling Pagination

PHP Codeigniter load data while Ajax Infinite scrolling Pagination

In this Post We Will Explain About is PHP Codeigniter load data while Ajax Infinite scrolling Pagination With Example and Demo.

Welcome on Pakainfo.com – Examples ,The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to load data while scrolling page down with jquery and PHP

In this post we will show you Best way to implement load data while scrolling page down with jquery and codeigniter, hear for How to PHP Codeigniter – Ajax Infinite Scroll Pagination Example with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Phase 1: Download Fresh Codeigniter 3

In First of all step you will create download fresh and latest version of simple Codeigniter 3 version, so if you any haven’t no download yet steps then download data from here : offical site like as a Download Codeigniter 3 Below.

Download

https://codeigniter.com/download

Phase 2: Create Database and Configuration

CREATE TABLE IF NOT EXISTS `customers` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `livedesc` text COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=16 ;

application/config/database.php

 '',
	'hostname' => 'localhost',
	'username' => 'live24u',
	'password' => 'live@$8554',
	'database' => 'mylivedatabase',
	'dbdriver' => 'mysqli',
	'dbprefix' => '',
	'pconnect' => FALSE,
	'db_debug' => (ENVIRONMENT !== 'production'),
	'cache_on' => FALSE,
	'cachedir' => '',
	'char_set' => 'utf8',
	'dbcollat' => 'utf8_general_ci',
	'swap_pre' => '',
	'encrypt' => FALSE,
	'compress' => FALSE,
	'stricton' => FALSE,
	'failover' => array(),
	'save_queries' => TRUE
);

Phase 3: Add Route

application/config/routes.php


Phase 4: Create Controller

application/controllers/LiveAjaxCtrl.php

load->database();
     $count = $this->db->get('customers')->num_rows();

     if(!empty($this->input->get("live_page"))){

      $start = ceil($this->input->get("live_page") * $this->perPage);
      $sql_query = $this->db->limit($start, $this->perPage)->get("customers");
      $data['customers'] = $sql_query->result();

      $result = $this->load->view('data', $data);
      echo json_encode($result);

     }else{
      $sql_query = $this->db->limit(5, $this->perPage)->get("customers");
      $data['customers'] = $sql_query->result();

	  $this->load->view('live-post', $data);
     }
    }

}

Phase 5: Create View Files

live-post.php: In this file, we will display layout with infinite ajax jquery.

data_live.php: In this file, we manage customers table data foreach, so we have to just manage customers data here.

application/views/live-post.php




	created by Pakainfo.com : Codeigniter infinite scroll with pagination
	
  	
  	



Codeigniter simple infinite scroll with pagination


load->view('data', $customers); ?>

application/views/data_live.php


title ?>

livedesc ?>


php -S localhost:8000
http://localhost:8000/live-cust

Example

I hope you have Got load data while scrolling page down with jquery and codeigniter And how it works.I would Like to have FeadBack From My Blog(Pakainfo.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(Pakainfo.com) Are Most Always Welcome.

I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.

Leave a Reply

Your email address will not be published. Required fields are marked *

We accept paid guest Posting on our Site : Guest Post Chat with Us On Skype