PHP Classes

PHP DB Operations: Perform common database operations using MySQLi

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 252 All time: 7,906 This week: 67Up
Version License PHP version Categories
db-operations 1.0GNU General Publi...5Databases
Collaborate with this project 

Author

db_operation_class - github.com

Description

This class can perform common database operations using MySQLi.

It can connect to a MySQL database using MySQLi extension and performs common database table records operations.

Currently it can retrieve all records of a given table, insert new table records, update and delete records of a table that match a criteria.

Picture of Yasir Buriro
  Performance   Level  
Name: Yasir Buriro <contact>
Classes: 2 packages by
Country: Pakistan Pakistan
Age: 30
All time rank: 348844 in Pakistan Pakistan
Week rank: 192 Up2 in Pakistan Pakistan Up

Example

<?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);
?>


Details

db_operation_class

Simple database class for operation with database securely


  Files folder image Files (4)  
File Role Description
Plain text file db_operations.php Class Class source
Accessible without login Plain text file example.php Example Example script
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Data Read me

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:252
This week:0
All time:7,906
This week:67Up