PHP Classes

DB Manager: Execute common SQL queries to a MySQL database

Recommend this page to a friend!
  Info   View files Example   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 225 This week: 1All time: 8,209 This week: 560Up
Version License PHP version Categories
db_manager 1.0.1Custom (specified...5PHP 5, Databases
Description 

Author

This class can execute common SQL queries to a MySQL database.

It can connect to a MySQL database and execute arbitrary queries or queries composed programatically from parameter values.

Currently it can execute SELECT queries to a given table, INSERT queries from a list of fields and values, and UPDATE or DELETE queries to table records matching a condition.

Picture of Kabir Hossain
  Performance   Level  
Name: Kabir Hossain <contact>
Classes: 3 packages by
Country: Bangladesh Bangladesh
Age: ???
All time rank: 383747 in Bangladesh Bangladesh
Week rank: 411 Up7 in Bangladesh Bangladesh Up

Example

<?php
   
include_once('Database.php');
   
$db = new Database('localhost','root','','db_example');
   
   
//insert example
       
$data = array(
           
'name' => 'Demo Insert',
           
'role' => 'Editor'
       
);
       
$db->insertData($table='users',$data);
       
//for getting insert id
        //echo $db->insertData($table='users',$data)->insertId();
       
    //select example
   
$select_data = $db->selectData($table='users', $select='id,name,role', $where=null, $or_where=null, $orderby='id', $limit=10, $offset=null);
   
print_r($select_data->result());
   
   
//update example
       
$data = array(
           
'name' => 'Demo Update',
           
'role' => 'Editor'
       
);
       
$where = 'id=4';// using string
        //$where = array('id'=>4);//using array
       
$db->updateData($table='users',$data,$where);

   
//delete example
       
$where = array('id'=>4,'status'=>0);//using array
        //$where = 'id=5 AND status=0';// using string
       
$db->deleteData($table='users',$where);
         
   


Details

db_manager

This class can query MySQL databases using SQL.

It can establish a connection to a MySQL server and execute SQL queries to the database tables.

The class can execute SQL SELECT, INSERT, UPDATE and DELETE queries from parameters that specify the tables, the fields and its values.

You can give parameter as a string or array.


  Files folder image Files  
File Role Description
Plain text file Database.php Class Class source
Accessible without login Plain text file db_example.sql Data Auxiliary data
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 Doc. Documentation

 Version Control Unique User Downloads Download Rankings  
 100%
Total:225
This week:1
All time:8,209
This week:560Up