Location: PHPKode > scripts > Jack's MySQL class > jacks-mysql-class/example2.php
<?php

// requre mySQL class
require_once('sql.class.php');

// set database values 
$_DBHOST = 'localhost';
$_DBUSER = 'root';
$_DBNAME = 'test';
$_DBPASS = '';

// 'start' the class

// 1st way: with out values 
// it will use $_DBHOST, $_DBUSER, $_DBNAME, $_DBPASS as defaults
$s = new sql();

// display all tables structures
// @note: table type is set to MyISAM as default (it is 4rd table argument)
print '<pre>';
print $s->dump_tbl();
print '</pre>';

// display all tables structures
// with mask $s->query("{$table_create_query}");
// @note: 2nd and 3rd arguments are the prefix and suffix for {$table_create_query}
print '<pre>';
print $s->dump_tbl(0, '$s->query("', '");');
print '</pre>';

// display 'test' table structure
print '<pre>';
print $s->dump_tbl('test');
print '</pre>';

// display all tables structures
// with mask $s->query("{$table_create_query}");
print '<pre>';
print $s->dump_tbl('test', '$s->query("', '");');
print '</pre>';

// display all tables content
print '<pre>';
print $s->dump_cont();
print '</pre>';

// display 'test' table content
// with mask $s->query("{$table_insert_query}");
print '<pre>';
print $s->dump_cont('test', '$s->query("', '");');
print '</pre>';

// close connection
$s->disconnect();

?>
Return current item: Jack's MySQL class