Login   Register  
PHP Classes
elePHPant
Icontem

File: testQueryList.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Oliver Susano  >  queryList  >  testQueryList.php  >  Download  
File: testQueryList.php
Role: Example script
Content type: text/plain
Description: sample script
Class: queryList
query with pagination and previous next
Author: By
Last change: -
Date: 2003-07-24 02:02
Size: 1,100 bytes
 

Contents

Class file image Download
<?
    
include ("dbConnect.php");
    include (
"queryList.php");
    
    
$sql "SELECT * FROM tbl_Country";

    
# syntax: queryList( $sql, $link, $page, [$rowsPerPage [, $pageLimit ]])
    
$queryList = new queryList$sql'testQueryList.php?'$page );
    
$result mysql_query ($queryList->sql);
    
?>
    <table cellpadding=0 cellspacing=0>
    <tr bgcolor=#808080 height=25 nowrap>
        <td width=150 nowrap>&nbsp;<b>Country Code</b></td>
        <td width=250><b>Country</b></td>
    </tr>
<?
    
# list elements in table with changing background on each row
      
while ( list ( $code$country ) = mysql_fetch_row($result) ){
        if(
$bgcolor=='#C9C9C9'){ $bgcolor='#DFDFDF'; } else { $bgcolor='#C9C9C9'; }
        echo 
"<tr bgcolor=$bgcolor height=25 nowrap>";
        echo 
"<td>&nbsp;$code</td>";
        echo 
"<td>$country</td>";
        echo 
"</tr>";
    }
?>
    </table>
<?
    
if($queryList->total >= 1) { echo "<br>Displaying records <font color=red>$queryList->start</font> - 
    <font color=red>
$queryList->stop</font> of <font color=red>$queryList->total</font>."; }
    if(
$queryList->pages 1) { echo "<br>Pages ( $queryList->pages ) : $queryList->result "; }
?>