PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Georgi Momchilov   DAO   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example
Class: DAO
Database access wrapper providing query queueing
Author: By
Last change: Reflects the new structure of the class
Date: 17 years ago
Size: 678 bytes
 

Contents

Class file image Download
include('alerter.class.php');
/* this class is used in dao::setError() . it is NOT included! you can change the line */

include('dao.class.php');
$dao = new dao('ibase');
$dao->db_logfile = '/path/to/logfile';

//example1:
$dao->query("INSERT into `table` SET `field1` = 'value1', `field2` = 'value2'");
$dao->commit();
$dao->rollback();

//example2:
$slave = $dao->getSlave();
$dao->connect( $slave );
while( $myrow = $dao->query("SELECT * FROM `table`") )
     echo $dao->db_pointer.' - '.var_dump( $myrow ).'<br />';

//example3:
$dao->connect('master');
$dao->queueSQL('DELETE FROM `table`', 'path/to/queuefile');
$dao->executeQueue('path/to/queuefile');