<?php
/*
* jMySQL Example
* by Johan De Klerk (johan@wisi.co.za)
* Freely distributable
*/
require_once('jMySQL.php');
$j = new jMySQL('localhost','dbname','root');
$fields = array('name','surname');
$tables = array('details','country');
$conditions = array("name='name 1'","surname='surname 1'");
$orderby = array('name','surname','desc');
$j -> jSelect($fields,$tables,$conditions,$orderby,'','0,10',1);
echo $j -> getQuery(). '<br>';
$fields1 = array('name','surname');
$values1 = array('johan','de klerk');
$j -> jUpdate('details',$fields1,$values1,'id',2);
echo $j -> getQuery(). '<br>';
$fields2 = array('id','name','surname','countryId');
$values2 = array('null','johan','de klerk',3);
$j -> jInsert('details',$fields2,$values2);
echo $j -> getQuery(). '<br>';
$j -> jInsert('details','',"'null','name','surname',6");
echo $j -> getQuery(). '<br>';
$j -> jDelete('details','id',15);
echo $j -> getQuery(). '<br>';
$j -> jCreateHeap('heap_table', $j->jSelect('name,surname','details','','','','',5));
echo $j -> getQuery(). '<br>';
$j -> jEmptyTable('heap_table');
echo $j -> getQuery(). '<br>';
$j -> jDropTable('heap_table');
echo $j -> getQuery(). '<br>';
echo $j -> getErrors();
?>
|