PHP Classes

Simple PHP Database Manager: Build and run SQL queries with a fluent interface

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-06-15 (9 months ago) RSS 2.0 feedStarStarStar 46%Total: 404 All time: 6,534 This week: 68Up
Version License PHP version Categories
db-manager 1.17GNU General Publi...5.3PHP 5, Databases
Description 

Author

This class can build and run MySQL queries with a fluent interface.

It can compose SQL SELECT, INSERT, UPDATE and DELETE queries with a fluent interface of functions to define several parameters of the queries.

The functions can define the table fields, field values, query conditions, etc..

Picture of Vagner vinicius bispo cantuares
  Performance   Level  

 

Example

<?php
require_once 'db_manager.php';

$db = DB_Manager::get_instance();
$db->database();

$db->table = 'users';

# all results.
$result = $db->select('*')->getAll();
echo
'<pre>';
   
var_export($result);
echo
'</pre>';

# one result.
$result = $db->select('*')->where('username', 'cantuares')->get();
echo
'<pre>';
   
var_export($result);
echo
'</pre>';

# insert record.
$result = $db->values(array('username' => 'fulano', 'password' => '***'))->insert();
echo
'<pre>';
   
var_export($result);
echo
'</pre>';

# update record.
$result = $db->set(array('username' => 'sicrano'))->where('username', 'fulano')->update();
echo
'<pre>';
   
var_export($result);
echo
'</pre>';

# delete record.
$result = $db->where('username', 'sicrano')->delete();
echo
'<pre>';
   
var_export($result);
echo
'</pre>';

?>


Details

PHP Database Manager

Small and simple class for MySQL database management.


  Files folder image Files (68)  
File Role Description
Files folder imageconfig (1 file)
Files folder imagedocs (1 directory)
Accessible without login Plain text file composer.json Data Auxiliary data
Plain text file db_manager.php Class Class source
Accessible without login Plain text file example.php Example Example script
Accessible without login Plain text file example_sql.sql Data Auxiliary data
Accessible without login Plain text file LICENSE Data Auxiliary data
Accessible without login Plain text file README.md Doc. Auxiliary data

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:404
This week:0
All time:6,534
This week:68Up
 User Ratings  
 
 All time
Utility:56%StarStarStar
Consistency:62%StarStarStarStar
Documentation:62%StarStarStarStar
Examples:56%StarStarStar
Tests:-
Videos:-
Overall:46%StarStarStar
Rank:3255