uuur86 / ubdb
Lightweight PHP-JSON Database
v0.329.1
2019-06-25 11:09 UTC
Requires
- php: >=5.6.6
This package is auto-updated.
Last update: 2024-10-29 04:53:22 UTC
README
JSON based database for PHP v0.328
REQUIREMENTS
PHP >= 5.2.0
INSTALL
Only include ubdb.php to your codes.
USAGE
$ubdb = new ubdb(); // For Selecting a language $ubdb->lang('en'); // For Define db, table and columns $ubdb->db('mydb', array( 'users'=>array( 'username', 'password', 'email', 'phone' ), 'products'=>array( 'productname', 'productcode', 'title', 'description' ), 'cart'=>array( 'productid', 'userid' ) ) );
ADD ROW
// add a row $ubdb->add('cart', array('userid'=>'ugur'.$i)); // or // You can add multiple rows for($i=0;$i<10;$i++){ $ubdb->add('cart', array('userid'=>'ugur'.$i)); } // If you defined all rows, you can save for writing new datas. $ubdb->save();
GET ROW
// For any simple query for getting datas // When runnig below code, will be same all getting datas // ? Symbol holding only one character, % symbol holding multiple character as place. $get1 = $ubdb->get("users", "username", array("ugur",'?','1') ); // matches such as ugur11 $get2 = $ubdb->get("users", "username", array("ug",'%','1') ); // matches such as ugur11 or ugor21 // Joining two data array on one intersect point $results = $ubdb->join( $get1, // first array $get2, // second array "username", // first intersect point "userid" // secondary intersect point ); // Will return as an array which is username equals to userid
DELETING
$ubdb->delete($table,$id);