Login   Register  
PHP Classes
elePHPant
Icontem

File: pdodb_example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of ofertino  >  PdoDB  >  pdodb_example.php  >  Download  
File: pdodb_example.php
Role: Example script
Content type: text/plain
Description: EXAMPLE FILE
Class: PdoDB
Connect to databases and execute queries using PDO
Author: By
Last change: Added explanations
Date: 2012-08-29 02:20
Size: 791 bytes
 

Contents

Class file image Download
<?
include_once('pdodb_class.php');
$DB = new PdoDB('DB0'); //Create a instance of PdoDB class with given ID
//ONLY FOR DEBUG
$DB->get_time true//Collect all connection and query time
$DB->debug true//Turn on debugging
//ONLY FOR DEBUG
$SQL "SELECT * FROM some_table";
$DB->query($SQL); //Query a SQL
$DB->next_record(); //Fetch first record from database
/**
Show one record
*/
echo $DB->f('some_row_name'); //This function returns a given row name ex.ID,name,etc.
/**
LOOPS
*/
while($DB->Eof()){ //Use this functions for loops
    
echo $DB->f('some_row_name'); //This function returns a given row name ex.ID,name,etc.
    
$DB->next_record(); //FETCH NEXT RECORD
}
//ONLY FOR DEBUG
$DB->print_all_time();//Print all connections and query time
//ONLY FOR DEBUG
?>