PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of arif purwanto   Simply MySQL DB   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example
Class: Simply MySQL DB
Execute common MySQL queries using MySQLi
Author: By
Last change:
Date: 8 years ago
Size: 809 bytes
 

Contents

Class file image Download
<?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);
}
?>