PHP Classes
elePHPant
Icontem

File: index.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Adler Brediks Medrado  >  Connection PDO Class  >  index.php  >  Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Example file
Class: Connection PDO Class
Wrapper to access SQL databases using the PDO API
Author: By
Last change:
Date: 9 years ago
Size: 908 bytes
 

Contents

Class file image Download
<?php
/*
 * Created on 30/01/2006
 */
 
 
include_once("connection/Connection.class.php");
 
$conn = new Connection();
 
 try {
    
$conn->connect();
 } catch (
Exception $e) {
    
print_r($e);
 }
 
 try {
    
$conn->beginTransaction();
 } catch (
Exception $e) {
    
print_r($e);
 }
 
 
$query1 = "insert into usuarios (nome, email) values ('Adler Brediks Medrado','adler@neshertech.net')";
 
 try {
    
$boInclusao = $conn->executeDML($query1);
 } catch (
Exception $e) {
    
print_r($e);
 }

$query2 = "select * from usuarios";
try {
    
$rsUsuarios = $conn->executeQuery($query2);
 } catch (
Exception $e) {
    
print_r($e);
 }

echo
"<pre>";
print_r($rsUsuarios);
echo
"</pre>";

$query3 = "delete from usuarios where nome = 'Adler Brediks Medrado'";
 
 try {
    
$boExclusao = $conn->executeDML($query3);
 } catch (
Exception $e) {
    
print_r($e);
 }
 
try {
   
$conn->rollback();
} catch(
Exception $e) {
   
print_r($e);
}
?>