Login   Register  
PHP Classes
elePHPant
Icontem

File: dbmasterExample.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Rafael Pinto  >  DBMaster  >  dbmasterExample.php  >  Download  
File: dbmasterExample.php
Role: Example script
Content type: text/plain
Description: DBMaster Example
Class: DBMaster
MySQL access wrapper with high level functions
Author: By
Last change: - Name change.
Date: 9 years ago
Size: 1,641 bytes
 

Contents

Class file image Download
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>DBMaster Test</TITLE>
<!-- Will be used in makeTable -->
<style>
th {
    background: blue;
    color: white;
    font-family: Verdana,Arial;
}
.odd {
    background: #EEDDDD;
    font-family: Verdana,Arial;
}
.even {
    background: #DDDDEE;
    font-family: Verdana,Arial;
}
</style>
</HEAD>
<BODY>
<?
//The first form to configure your DBMaster instace is through defines
define('DBMASTER_DB','myDB');                //Database to be selected is 'myDB'
define('DBMASTER_DEBUG',1);                    //Set debug mode ON
define('DBMASTER_REDIRECT','error.html');    //Redirects to 'error.html' on error

include('dbmaster.php');                     //Includes the class file

$db = new DBMaster();                         //Create a DBMaster instance

//You can also configure it by simply changing its properties
$db->logfile 'myLogFile.txt';                //Logs queries to 'myLogFile.txt'
$db->mailto 'my@mail.com';                //Send errors to 'my@mail.com'

$db->listTables();                            //Stores list of tables from 'myDB'
echo $db->makeTable('','','','even','odd');    //Outputs a html table with different classes for even and odd rows (from above CSS)
$db->listFields('myTable');                    //Stores fields from 'myTable'
echo $db->makeTable('','','','even','odd'); //Outputs a html table...
echo $db->dump(true);                        //Outputs SQL CREATE script for tables in 'myDB'
$db->dumpToFile('myDump.txt');                //Outputs SQL CREATE script for tables in 'myDB' to 'myDump.txt'
$db->select('MyTable','My_Field');            //'SELECT My_Field FROM MyTable'
echo $db->makeList();                        //List values from last query
?>
</BODY>
</HTML>