PHP Classes
elePHPant
Icontem

File: test2.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Ruthger  >  textDB  >  test2.php  >  Download  
File: test2.php
Role: Example script
Content type: text/plain
Description: Test file
Class: textDB
A database class using csv files
Author: By
Last change:
Date: 13 years ago
Size: 911 bytes
 

Contents

Class file image Download
<?
 
include("textdb.php");
 
 
$test = New textDB("test.txt", 1);
?>
Raw unsorted records<br>
<?
  $record
= $test->first();
  while (
$record)
  {
    echo
$record[id]." ".$record[label]."<br>";
   
$record = $test->next();
  }
?>
<br><br>Sort in ascending order<br>
<?

  $test
->sort("A");
 
 
$record = $test->first();
  while (
$record)
  {
    echo
$record[id]." ".$record[label]." ".$record[text]."<br>";
   
$record = $test->next();
  }
?>
<br><br>Sort in descending order<br>
<?
  $test
->sort("D");
 
 
$record = $test->first();
  while (
$record)
  {
    echo
$record[id]." ".$record[label]." ".$record[text]."<br>";
   
$record = $test->next();
  }
?>
<br><br>No sortering<br>
<?
  $test
->sort();
 
 
$record = $test->first();
  while (
$record)
  {
    echo
$record[id]." ".$record[label]." ".$record[text]."<br>";
   
$record = $test->next();
  }
?>