Location: PHPKode > scripts > Connection PDO Class > connection-pdo-class/index.php
<?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','hide@address.com')";
 
 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);
}
?>
Return current item: Connection PDO Class