<?php
require_once './FDB.php';
/* Create connection to a FILE DB Table */
$pathdir = 'DBASE/';
$link = FDB::fconnect( $pathdir, FDB::DEBUG_MODE );
/* Create a FILE DB Table */
/*PROTOTYPE: FDB::fcreate( $link, $table_name, $cols ) */
$newtable = FDB::fcreate( $link, 'store', array('storeid:auto_increment', 'storetypetitle') );
/* INSERT INTO a FILE DB Table */
/*PROTOTYPE: FDB::finsert( $link, $table_name, $cols, $data )*/
$insert = FDB::finsert( $link, 'store', array('storetypetitle'), array(array('Earrings'),
array('Bracelet'),
array('Wrist-Watch')) );
echo FDB::faffected_rows();
/*Display All Data*/
echo 'ALL DATA:';
$select = FDB::fload( $link, 'store', '*', false );
var_dump( $select );
echo '<br/><br/><br/><br/><br/>';
/*Display All Data*/
/* UPDATE INTO a FILE DB Table */
/*PROTOTYPE: FDB::fupdate( $link, $table_name, $update_list=array(), $condition=false, $limit=false )*/
$update = FDB::fupdate( $link, 'store', array('storetypetitle'=>'New Bracelet'), array('storetypetitle'=>'Bracelet'), 1 );
echo FDB::faffected_rows();
/*Display All Data*/
echo 'ALL DATA:';
$select = FDB::fload( $link, 'store', '*', false );
var_dump( $select );
echo '<br/><br/><br/><br/><br/>';
/*Display All Data*/
/* DELETE FROM FILE DB Table */
/*PROTOTYPE: FDB:fdelete( $link, $table_name, $condition='*', $limit=false ) */
$delete = FDB::fdelete( $link, 'store', array('storetypetitle'=>'Wrist-Watch'), 1 );
echo FDB::faffected_rows();
/*Display All Data*/
echo 'ALL DATA:';
$select = FDB::fload( $link, 'store', '*', false );
var_dump( $select );
echo '<br/><br/><br/><br/><br/>';
/*Display All Data*/
/* SELECT FROM FILE DB Table */
/*PROTOTYPE: FDB::fload( $link, $table_name, $retreive_cols='*', $condition=false, $limit=false )*/
$select = FDB::fload( $link, 'store', '*', false );
var_dump( $select );
?>
|