PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Yasir Buriro   PHP DB Operations   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP DB Operations
Perform common database operations using MySQLi
Author: By
Last change:
Date: 7 years ago
Size: 880 bytes
 

Contents

Class file image Download
<?php
include_once("db_operations.php");
$dboperations =new db_operations("localhost","root","","user_management");
//array
 
$arr=array(
   
"user_id"=>9,
   
"user_name"=>"ali",
   
"user_lname"=>"buriro",
   
"user_email"=>"ali@gmail.com",
   
"user_pass"=>"ali",
   
"user_fname"=>"akbar",
   
"role"=>2
);

//inserting record into users table
echo $dboperations->insertData("users",$arr);

//update record from users having user_id=9
echo $dboperations->updateData("users",$arr,9);
// //Returning Multidimensional array
echo "<pre>";(print_r($dboperations->selectData("users")));

//fetching data with user_id 2
 
foreach($dboperations->selectData("users") as $k => $v){
    if(
$k==2){
        foreach(
$v as $key => $value){
            echo
$key."=>".$value."<br>";
        }
    break;
    }
}

//deleting record from table users having user_id=9
echo $dboperations->delete("users",9);
?>