Login   Register  
PHP Classes
elePHPant
Icontem

File: test_sub.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Reneesh T K  >  PHP AJAX pagination  >  test_sub.php  >  Download  
File: test_sub.php
Role: Auxiliary script
Content type: text/plain
Description: test sub page
Class: PHP AJAX pagination
Show MySQL query results split in pages using AJAX
Author: By
Last change:
Date: 5 years ago
Size: 1,075 bytes
 

Contents

Class file image Download
<?php
include('pagination_class.php');
mysql_connect('host name''user''password') or die(mysql_error());
mysql_select_db('dbname');
?><?
$qry 
"SELECT * FROM students";

if(
$_REQUEST['search_text']!=""){
    
$searchText $_REQUEST['search_text'];
    
$qry .=" where name like '$searchText%'";
}

//for pagination
if(isset($_GET['starting'])&& !isset($_REQUEST['submit'])){
    
$starting=$_GET['starting'];
}else{
    
$starting=0;
}
$recpage 2;//number of records per page
    
$obj = new pagination_class($qry,$starting,$recpage);        
$result $obj->result;
?>
<table border="1" align="center" width="100%">
<tr><TD>Sl no</TD><TD>Name</TD></tr>
<?if(mysql_num_rows($result)!=0){
    
$counter $starting 1;
    while(
$data mysql_fetch_array($result)) {?>
        <tr>
        <TD><? echo $counter?></TD>
        <TD><? echo $data['name']; ?></TD>
        </tr><?
        $counter 
++;
    } 
?>

        
    <tr><TD colspan="2"><? echo $obj->anchors?></TDcolspan="2"></tr>
    <tr><TD colspan="2"><? echo $obj->total?></TD></tr>
<?}else{?>
    <tr><TD align="center" colspan="2">No Data Found</TD></tr>
<?}?>
</TD></tr>
</table>