PHP Classes

File: test1.php

Recommend this page to a friend!
  Classes of Pali   Textable   test1.php   Download  
File: test1.php
Role: Example script
Content type: text/plain
Description: Sample file
Class: Textable
Manage data in text files like database tables
Author: By
Last change: Updated file
Date: 19 years ago
Size: 1,066 bytes
 

Contents

Class file image Download
<?php

function show_table($data){
    echo
"<table border=\"1\">";
    foreach (
$data as $row){
        echo
"<tr>";
        foreach (
$row as $field){
            echo
"<td>".$field."</td>";
        }
        echo
"</tr>";
    }
    echo
"</table><br>";
}

include
"textable.class.php";

$tb = new textable("data.dat");

//$tb->insert(array("Norman Mailer","nm@mailer.org","Nothing"));

//$tb->insert(array(array("Norman Mailer1","nm@mailer.org","Nothing"),
// array("Norman Mailer2","nm@mailer.org","Nothing"),
// array("Norman Mailer3","nm@mailer.org","Nothing")));

//$tb->update(array("J.D.Salinger"), array("","","Anything"));
//$tb->update(array("J.D.Salinger"), array("Norman Mailer","","Anything"));
//$tb->update(array("","","Nothing"), array("","","Anything"));

//$tb->delete(array("","","Nothing"));

//$tb->save();

//$lines = $tb->select(array("","","Nothing"));
//if ($lines){show_table($lines);}

show_table($tb->table);

if (
$tb->error == ""){$tb->error = "No";}

show_table(array(array("Error:", $tb->error)))


?>