<?php
/*
Written by Aziz S. Hussain
@
www.AzizSaleh.com
Produced under LGPL license
@
http://www.gnu.org/licenses/lgpl.html
*/
// Include
include('database.php');
// Connect
$database = new database('localhost','root','','amana');
// Execute Bind Query
$sql = 'INSERT INTO clients (clientName,ClientPhone) VALUES (?,?)';
$database->query($sql,array('TestClient','TestPhone'));
$sql = "INSERT INTO clients (clientName,clientPhone) VALUES (?,'311')"
$database->query($sql,'TestName');
// Execute Blind Insert
$_POST = array('clientName' => 'Test', 'clientPhone' => 411);
$database->insert('clients',$_POST);
// Execute Blind Update
$_POST = array('clientID' => 1, 'clientName' => 'Test', 'clientPhone' => 411);
$database->insert('clients',$_POST);
// Get results (by assoc)
$results = $database->result('SELECT * FROM clients');
print_r($results);
// Delete records
$database->delete('clients',1); //-> Delete client at primary key 1 @ clients table
$database->delete('clients','TestName','clientName');
//-> Delete user with clientName value of TestName
$database->delete('clients',array('clientName' => 'TestClient', 'clientPhone' => 311));
//-> Delete user with multiple matches
// Escape user variables
$safeValue = $database->escape($_POST['badValue']);
// Create table
$_POST = array('clientName' => NULL,'clientPhone' => NULL);
$database->createTable('clients',$_POST,'clientID');
//-> Create clients table with clientName,clientPhone and clientID as primary key
// End of file /exampleUsage.php
|