Login   Register  
PHP Classes
elePHPant
Icontem

File: usage.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Gaidar  >  Split Result  >  usage.php  >  Download  
File: usage.php
Role: Example script
Content type: text/plain
Description: Example of using SplitResult
Class: Split Result
Split MySQL query results between pages
Author: By
Last change:
Date: 10 years ago
Size: 784 bytes
 

Contents

Class file image Download
<?
/* Example of using SplitResult class by Gaidar Magdanurov */

// config file
require('config.php');

// splitter class
require('split_result.php');

// connect database
// look into mysql_data.sql fro information about database
mysql_connect($mysql_host$mysql_user$mysql_pass);
mysql_select_db($mysql_db);

$result mysql_query("select * from test_table"); // select data
$sr = New SplitResult($result$split_by); // init splitter object
if(empty($page)) $page 1;
@
$res $sr->content($page); // get data

// print result
for($i 0$i <= (count($res) - 1); $i++){
    echo 
'<p>Name:&nbsp;'.$res[$i]['name'].'E-Mail:&nbsp;'.$res[$i]['mail'].'</p>';
}

// print menu
echo '<p align="center">'.$sr->menu($page'./usage.php?page=').'</p>'."\n"

?>