Format
CRUD functions
CRUD functions
Create
// to insert new data to your DB, simply use:
$mb->addMBRecord($table,$data);
// where $table represent which table to insert your data into
// and $data is array of columns
// example:
$add['name']='John Doe';
$add['age']=42;
$add['register_date']=time();
$mb->addMBRecord('clients',$add);
// OR
$clientID = $mb->addMBRecord('clients',$add);
// it will return the last inserted id assigned to variable $clientIDRead ( Retrieve )
Read All Data
// you can fetch data from DB in different ways according to your needs
// if you want to fetch all data in a table
$data = $mb->getMBAllData($table, $cond, $printquery = 0);
// $data: the variable will hold your array in array data
// $table: from which table you want to fetch data
// $cond: the where clause, just add '1' to fetch ALL data, or add some conditions like 'age>40' or 'age=42 and gender="male"'
// you can always ignore the last command, or add 1 for debugging and print the sql queryRead a Single Row
Read a Single ( or multiple non-ordered ) Fields
Update
Delete
Last updated
Was this helpful?