Login   Register  
PHP Classes
elePHPant
Icontem

File: dump_test.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Eduardo Henrique Molina da Cruz  >  Perfect Database File 2  >  dump_test.php  >  Download  
File: dump_test.php
Role: Example script
Content type: text/plain
Description: Example file
Class: Perfect Database File 2
File based database manager with SQL query support
Author: By
Last change:
Date: 9 years ago
Size: 1,417 bytes
 

Contents

Class file image Download
<?php

header
("Content-type: text/plain\n\n");

include(
"../dbf-2.0/dbf-include.php");

$dbf->query("CREATE DATABASE `dump_test`");
echo 
"database created!\n";

$dbf->select_db("dump_test");
echo 
"database selected!\n";

$sql_dump "

CREATE TABLE `users_test`
(
    `id` INT NOT NULL AUTO_INCREMENT KEY ,
    `domain` CHAR (100) NOT NULL ,
    `name` CHAR (100) NULL default 'ppo'
);

INSERT INTO `users_test` values 
(1,'eduardo.net','Eduardo Cruz') ,
(2,'google.com.br',null) ,
(4,'dgfsdf.net','irene');

CREATE TABLE `users_test2`
(
    `id` INT NOT NULL AUTO_INCREMENT KEY ,
    `domain` CHAR (100) NOT NULL ,
    `name` CHAR (100) NULL default 'ppo'
);

INSERT INTO `users_test2` values 
(1,'eduardo.net','Eduardo Cruz') ,
(2,'google.com.br',null) ,
(4,'dgfsdf.net','irene');


"
;

$dbf->query($sql_dump);
echo 
"dump test ok!\n";

$select $dbf->query("select * from users_test");

while (
$row $dbf->fetch_array($select))
    
print_r($row);

$q2 $dbf->query("LIST databases");
while (
$row $dbf->fetch_array($q2))
{
    
print_r($row);
}

$q3 $dbf->query("LIST tables");
while (
$row $dbf->fetch_array($q3))
{
    
print_r($row);
}

$q3 $dbf->query("LIST fields of table users_test");
while (
$row $dbf->fetch_array($q3))
{
    
print_r($row);
}

$q3 $dbf->query("show create table users_test");
$createtb $dbf->fetch_array($q3);
    
print_r($createtb);


$dbf->query("drop DATABASE `dump_test`");
echo 
"database dropped!\n";

?>