PHP Classes

PDO Database class: Access SQL databases using PDO

Recommend this page to a friend!
  Info   View files Example   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 1,004 This week: 1All time: 3,636 This week: 560Up
Version License PHP version Categories
db-pdo-simple-class 1.0GNU General Publi...5.2PHP 5, Databases
Description 

Author

This package can access SQL databases using PDO.

There is a base configuration class that builds the database connection string.

The actual database access class is a sub-class that established the database connection using the PDO extension and executes SQL queries.

It can execute one or more INSERT or UPDATE queries using prepared statements, execute SELECT queries and return the whole result set into an array, and retrieve the number of records in a given table.

Picture of Assontia Patient
Name: Assontia Patient <contact>
Classes: 1 package by
Country: Cameroon Cameroon
Age: 40
All time rank: 23592 in Cameroon Cameroon
Week rank: 416 Up4 in Cameroon Cameroon Down

Example

<?php
   
// change the values by yours
   
include('library/library.php');
   
$a = new db;
   
$a->table = 'site_colors'; // your table name
   
   
$records = $a->select("SELECT * FROM $a->table");
    echo
$a->count($a->table) . " records found!";
   
// records of a table
   
echo "<pre>";
    foreach(
$records as $r){
       
print_r($r);
    }
   
   
// refresh to see the effect of the insert
   
$a->insert("INSERT INTO $a->table(name, class) VALUES('Blink', 'blink');");
   
   
// other or all sql queries can be sent using
   
$a->sql('DELETE ....');
   
?>


  Files folder image Files  
File Role Description
Files folder imageclasses (1 file)
Files folder imagelibrary (1 file)
Accessible without login Plain text file config.php Conf. Configure your database parameters
Accessible without login Plain text file test.php Example Test file to edit before launching

  Files folder image Files  /  classes  
File Role Description
  Plain text file db.class.php Class Database class

  Files folder image Files  /  library  
File Role Description
  Accessible without login Plain text file library.php Conf. Library of functions and globals

 Version Control Unique User Downloads Download Rankings  
 0%
Total:1,004
This week:1
All time:3,636
This week:560Up
User Comments (1)
In english please?
11 years ago (Vitaliy)
35%StarStar