Location: PHPKode > scripts > MySQL-class > mysql-class/example.txt
<?php

// conection
$mysql= new mysql('localhost' , 'userSQL', 'passwSQL', 'Selected_DB' );
$mysql->connect();

// fetch row
$row=$mysql->fetch_row( 'TableName', " id='12' ");

// fetch array of rows
$rows=$mysql->list_table( 'TableName', " column='3' ", array ('range' => 'id,name') ); 

// fetch rows from multiple tables
$rows=$mysql->list_table( ' TableName1 t1,TableName1 t2 ', " t1.column1=t2.column2 ", array ('range' => ' t1.column1_1, t2.column1_2 ') ); 


// fetch whole table
$tableList=$mysql->list_table( 'TableName', false ,  );


// fetch a part of a table - pagination example 
$parameters['limitOffset']=10; # Offet Start 
$parameters['rowCount']=10; # No of rows returned
$where=" columnName='3' ";
$tableList=$mysql->list_table( 'TableName', where , $parameters );

$data=array('columnName1' => 'value1',
            'columnName2' => 'value2',
            'columnName3' => 'value3',        
            );		
// insert data ... it returns true or false
$insertAtempt=$mysql->record_insert('TableName',$data);

// update data
$updateAtempt=$mysql->record_update('TableName',$data," id='3' ");  

	
?>
Return current item: MySQL-class