PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Kabindra Bakey   PHP Database Handler class   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example Page
Class: PHP Database Handler class
Access MySQL database records using parameters
Author: By
Last change:
Date: 11 years ago
Size: 1,132 bytes
 

Contents

Class file image Download
<?php
require('mini-config.php');

//Make Query in Database
/** Sample DB Strct
 * table: users [id, username, password, status]
 * */
 
/** Select all Records from users table */
$arrList = DBHandler::QueryArray('users');

/** Select all records with selected columns of users table */
$arrList = DBHandler::QueryArray('users', array('id', 'username', 'password', 'status'));

/** Select specific records of users table */
$arrList = DBHandler::QueryArray('users', array('id', 'username', 'password', 'status'), 'status = 1');

/** Select specific records and sort them by username of users table */
$arrList = DBHandler::QueryArray('users', array('id', 'username', 'password', 'status'), '', 'username asc');

/** Insert Records of users table */
$intUIN = DBHandler::Insert('users', array('username'=>'kabindra', 'password'=>'qwerty', 'status'=>1));

/** Update Records of users table */
$intUIN = DBHandler::Update('users', array('password'=>'newpassword'), 'username = "kabindra"');

/** Delete Records of users table */
$intUIN = DBHandler::Delete('users', 'username = "kabindra"');