PHP Classes
Icontem

File: example.txt


  Search   All class groups All class groups   Latest entries Latest entries   Top 10 charts Top 10 charts   Newsletter Newsletter   Blog Blog   Forums Forums   Help FAQ Help FAQ  
  Login   Register  
Recommend this page to a friend! ReTweet ReTweet Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of solomongaby  >  MySQL-class  >  example.txt  
File: example.txt
Role: Example script
Content type: text/plain
Description: examples of use
Class: MySQL-class
MySQL database access wrapper
 

Contents

Class file image Download
<?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' ");  

    
?>

 
  Advertise on this site Advertise on this site   Site map Site map   Statistics Statistics   Site tips Site tips   Privacy policy Privacy policy   Contact Contact  

For more information send a message to :
info at phpclasses dot org.
Copyright (c) Icontem 1999-2009 PHP Classes - PHP Class Scripts
  PHP Book Reviews - Reviews of books and other products