PHP Classes
elePHPant
Icontem

File: exemplo.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Renan Martins Pimentel  >  MySQL-PDO  >  exemplo.php  >  Download  
File: exemplo.php
Role: Class source
Content type: text/plain
Description: Exemplo das funções da class MySql
Class: MySQL-PDO
Execute MySQL queries using PDO
Author: By
Last change:
Date: 2 years ago
Size: 557 bytes
 

Contents

Class file image Download
<?php
    $db
= new MySql();
   
   
$query = "SELECT * FROM TABLE WHERE 1";
   
$select = $db->select($query);

   
//Mostrar o Array gerado pela Class
   
echo "<pre>";
   
print_r($select);

   
//Total de registros
   
echo $db->getNumRows($select);

   
//Inserindo dados no Banco
   
$queryInsert = "INSERT INTO TABLE (COLUMNS_01) VALUES ('VALUE_01')"
   
$insert = $db->insert($queryInsert);

   
//Ultimo ID inserido
   
echo $db->getId();

   
//Atualizando uma tabela
   
$queryUpdate = "UPDATE TABLE SET COLUMNS_01 = 'VALUE_01 WHERE ID_COLUMNS = $var";
   
$update = $db->insert($queryUpdate);
?>