1) Functions Description :
(a) setup_conn()::This function used to establish a connection to database
(b) db_connect()::This function is also used to establish a connection to database
(c) select_db()::This function is used to select database
(d) query()::This function is used to execute a query and get result from it
(e) fetch_array()::This function is used to fetch an array of query result
(f) num_rows()::This function is responsible for give num of rows
(g) last_insertid(::This function is give last inserted id
(h) insert_record()::This function is used to insert a record
(i) update_record()::This function is used to select record
(j) delete_record()::This function is used to delete records according to condition
(k) select_record()::This function is used to select records according to OR condition
(l) delete_all_record()::This function is used to delete all records from a table
(m) select_all_record()::This function is used to select all records from a table
(n) fetchSingleRow($result)::For fetch single record
(o) executeQuery($query)
(p) select_records::This function is used to select records according to AND condition
//How we connect database using dbclass
$hostname_glb = "localhost";
$username_glb = "username";
$password_glb = "password";
$database_glb = "dbname";
$dbobj -> setup_conn($hostname_glb,$username_glb,$password_glb);
$dbcon = $dbobj -> db_connect();
$dbobj -> select_db($database_glb,$dbcon);
//Code For Insert Record
$sql_arr = array('Username' => $Username,'Name' => $Name,'Surname' => $Surname,'Address' => $Address,'Phone' => $Phone,'Email' => $Email,'Password' => $Password);
$table = "tbl_booker";
$dbobj ->insert_record($sql_arr,$table);
//Code For Update Record
$condition_arr = array('BookerId' => $BookerId);//You can add more conditions each separate by comma
$table = "tbl_booker";
$sql_arr = array('Username' => $Username,'Name' => $Name,'Surname' => $Surname,'Address' => $Address,'Phone' => $Phone,'Email' => $Email);
$dbobj ->update_record($sql_arr,$condition_arr,$table);
//Code For Select Record
[1]
$sql = "----Any Sql Query Which You Want To Execute----";
$res = $dbobj->query($sql);
$num_row = $dbobj->num_rows($res);
[2]
$result_set = select_record($conditon,$table)
[3]
$result_set = select_all_record($table);
No comments:
Post a Comment