PHP Classes

Simply MySQL DB: Execute common MySQL queries using MySQLi

Recommend this page to a friend!
  Info   View files Example   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 353 All time: 6,959 This week: 107Up
Version License PHP version Categories
simply-mysql 2.0Artistic License5.0PHP 5, Databases
Description 

Author

This class can execute common MySQL queries using MySQLi.

It can connect to a given MySQL database using the PHP MySQLi extension.

The class can execute SQL SELECT, INSERT, UPDATE, DELETE queries with parameters that define tables, the list of fields and their values, and condition clauses.

For SELECT queries the result counts and result set rows are returned separately.

Picture of arif purwanto
  Performance   Level  
Name: arif purwanto <contact>
Classes: 2 packages by
Country: Indonesia Indonesia
Age: ???
All time rank: 250940 in Indonesia Indonesia
Week rank: 387 Up11 in Indonesia Indonesia Up

Example

<?php
include "mysql_class.php";
$db = new mysqlDatabase("localhost","root","","test");
$table = array("coba");
$fld = array("*");
if(
$db->dbSelect($table,$fld)){
    echo
$db->getNumRows();
    while(
$data=$db->getRows()){
       
var_dump($data);
    }
} else {
   
trigger_error($db->getErrorMessage(),E_USER_ERROR);
}

$dtInsert=array("user"=>"admin","pass"=>"123");
if(
$db->dbInsert("coba",$dtInsert)){
    echo
"Berhasil";
} else {
   
trigger_error($db->getErrorMessage(),E_USER_ERROR);
}
$dtUpdate = array("pass"=>"Administrator");
if(
$db->dbUpdate("coba",$dtUpdate,"user = 'admin'")){
    echo
"Berhasil";
} else {
   
trigger_error($db->getErrorMessage(),E_USER_ERROR);
}
if(
$db->dbDelete("coba","user='admin'")){
    echo
"Berhasil";
} else {
   
trigger_error($db->getErrorMessage(),E_USER_ERROR);
}
?>


  Files folder image Files  
File Role Description
Accessible without login Plain text file example.php Example example
Plain text file mysql_class.php Class Simply Mysql Database v2.0

 Version Control Unique User Downloads Download Rankings  
 0%
Total:353
This week:0
All time:6,959
This week:107Up