Version: 1.1 Alpha
Fenix_db is a grup of function for apstraction mysql database. You can use this library to easier manipulate with database.
Clone the repo and use this file for install into jour project.
- fx_createTable -> Create new table
- fx_delete -> Delete table into db
- fx_drop -> Drop Database
- fx_insert -> Insert in database
- fx_select -> select from table
- fx_tableList -> list of all table into db
- fx_update -> update info into table
- In file where use db Class include 'ini_db.php'
- Connect on data base
- Create object like -> $baseApi = new Fenix_baseApi();
$baseApi = new Fenix_baseApi(); // create object
//create array
$arr_base = array(
'table' => 'test_base',
'select' => array(
'id',
'text'
),
'where' => ' text = "petar" or id = 1 ',
'order' => 'ASC'
);
$value = $baseApi -> fx_select( $arr_base ); // call function witch return array
$arr_base_create = array(
'table' => 'test_base',
'value' => array(
'text' => 'dexter',
'test' => 'more text into test',
'test2' => 'test 2 more more more'
)
);
$value2 = $baseApi -> fx_insert( $arr_base_create );
$arr_base_delete = array(
'table' => 'test_base',
'where' => ' id = 3 or text = "dexter" '
);
$val3 = $baseApi -> fx_delete($arr_base_delete);
$arr_base_create_table = array(
'table' => 'new_table',
'tableType' => 'innodb', // defalut parametar if not entered innodb
'value' => array(
'id' => 'int NOT NULL AUTO_INCREMENT', // if id not created by user script automaticly add this value
'FirstName' => 'varchar(15)',
'LastName' => 'varchar(15)',
'Age' => 'int'
),
'primary' => 'id' // if primary key not added by user script automaticly add id for primary key
);
$value3 = $baseApi -> fx_createTable($arr_base_create_table);
$list = $baseApi -> fx_tableList(); //return array
$arr_base_update = array(
'table' => 'new_table',
'value' => array(
'FirstName' => 'petar',
'LastName' => 'johns'
),
'where' => "id = 1 or age = 22"
);
$update = $baseApi -> fx_update( $arr_base_update );
$arr_base_drop = array(
'table' => 'new_table1'
);
$drop = $baseApi -> fx_drop( $arr_base_drop );
*ini_db.php => this file call all core function for execute database function. *.dbconector.php => is not core function this is my database connect class and you don't need to use this way for connecting on database. *dataBaseFunction.core => is core function for database and you don't need to change anything into this. *db_handler.php => is class witch extends dataBaseFunction *db_helper.php => this file is helper for core.