PHP Classes

File: exemplo.php

Recommend this page to a friend!
  Classes of Vanio   Conexão com PDO no MySQL   exemplo.php   Download  
File: exemplo.php
Role: Example script
Content type: text/plain
Description: exemplo de uso da classe Sql com PDO
Class: Conexão com PDO no MySQL
Run MySQL queries and manage transactions with PDO
Author: By
Last change:
Date: 10 years ago
Size: 429 bytes
 

Contents

Class file image Download
<?php
 
include_once 'class.Sql.php';

    try{

     
$conn = new Sql();
     
$conn->open();
     
$insert = $conn->prepare("INSERT INTO usuario(fk_tipo, nome, td_cadastro) VALUES ('1', 'Vanio Almeida', NOW())");
     
$insert->execute();

     
$conn->commit();
     
$conn = NULL;
     }
  catch(
Exception $e)
    {
     
$conn->rollBack();
     
$conn = NULL;
      echo
$e->getMessage();
    }

   
?>