PHP Classes

File: examples/db/example_db_pdo.php

Recommend this page to a friend!
  Classes of Haseeb Ahmad Basil   PHP Skeleton Framework   examples/db/example_db_pdo.php   Download  
File: examples/db/example_db_pdo.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Skeleton Framework
Extensive Web application development framework
Author: By
Last change:
Date: 8 years ago
Size: 515 bytes
 

Contents

Class file image Download
<?php
include 'config.php';

// need to set the database type for PDO factory
$ConfigArray['DBDSN']['phptype'] = 'mysql';

$db = new A_Db_Pdo($ConfigArray['DBDSN']);
$db->connect();
if (!
$db->isError()) {

   
$sql = "SELECT * FROM users";
   
$result = $db->query($sql);
    if (!
$db->isError()) {
       
dump($result->fetch(), '__call: fetch(): ');
       
       
$row = $result->fetchAll();
dump($row, 'ROW: ');

    } else {
        echo
'connect ERROR: ' . $db->getErrorMsg();
    }
   

} else {
    echo
'connect ERROR: ' . $db->getErrorMsg();
}