<?php
 
/**
 
 * Author: Itay Segal
 
 * This is usage example for mysql connector
 
 **/
 
include_once 'DBMethods.php';
 
$db = new DBMethods(true);
 
 
/**
 
 * Get All rows in table
 
 */
 
$result = $db->getMultipleRows('my_table');
 
echo "<pre>";print_r($result);
 
 
/**
 
 * Insert new data into my_table
 
 */
 
$fields = array('field1','field2');
 
$values = array('Value1','Value2');
 
$result = $db->insertRecords($fields,$values,'my_table');
 
if($result){
 
    echo 'Data was added successfully';
 
}
 
else{
 
    echo 'There was an error, please check your log file';
 
}
 
 
/**
 
 * Update data in my_table
 
 */
 
$sets   = array('field1=Value2','field2=Value1');
 
$result = $db->UpdateRecords('my_table',$sets,'id=1');
 
if($result){
 
    echo 'Data was updated successfully';
 
}
 
else{
 
    echo 'There was an error, please check your log file';
 
}
 
 |