PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Aderbal Nunes  >  PDO Connection Factory  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: User example
Class: PDO Connection Factory
Manage database connections using PDO extension
Author: By
Last change:
Date: 14 years ago
Size: 470 bytes
 

Contents

Class file image Download
<?php
@require("PDOConnectionFactory.class.php");

$db = new PDOConnectionFactory();
$pdo = $db->getConnection();

/**
 * example of list for names of table 'agenda'
 */
try{
   
$stmt = $pdo->prepare("SELECT * FROM agenda");
   
$stmt->execute();
   
    while (
$rs = $stmt->fetch(PDO::FETCH_OBJ)) {
        
// 'name' is real name of field
        
echo "output: ".$rs->name."<br />";
    }
   
$pdo = null;
}catch(
PDOException $e){ echo $e->getMessage(); }

For more information send a message to info at phpclasses dot org.