PHP Classes
elePHPant
Icontem

File: example_2.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Paul Gillespie  >  SQL Data Manager  >  example_2.php  >  Download  
File: example_2.php
Role: Example script
Content type: text/plain
Description: This is an example of using the manager to return data in chunks via the more processing flag and limit assignments.
Class: SQL Data Manager
Access MySQL databases
Author: By
Last change:
Date: 5 years ago
Size: 1,124 bytes
 

Contents

Class file image Download
<?php

include_once("SQLDataManager/SQLDataManager.php");

$ConfigFile = "config/mysql_access.config";
$Sql = "select * from r_shop_data";
$DataChunks = 50;

$SQLDataManager = new SQLDataManager($ConfigFile);

$SQLDataManager->setType("R");
$SQLDataManager->setSql($Sql);
$SQLDataManager->setLowerLimit(0);
$SQLDataManager->setUpperLimit($DataChunks);

while(
$SQLDataManager->getMoreData()) {
   
$Status = $SQLDataManager->performSql();

    if(
$Status == 1) {
       
$Results = $SQLDataManager->getResults();

       
$RowCount = $Results->getRowCount();

        for(
$Row=0; $Row<$RowCount; $Row++) {
           
$ShopName = $Results->getRow($Row)->get_shop_name();

            print(
$ShopName->getValue() . "<br/>");
            print(
$ShopName->getUppercase() . "<br/>");
            print(
$ShopName->getLowercase() . "<br/>");
        }

       
$SQLDataManager->setLowerLimit($SQLDataManager->getUpperLimit());
       
$SQLDataManager->setUpperLimit($SQLDataManager->getUpperLimit() + $DataChunks);
    }
    else {
        print(
"An error has occured.");
    }
}

?>