PHP Classes

File: test.php

Recommend this page to a friend!
  Packages of Assontia Patient   PDO Database class   test.php   Download  
File: test.php
Role: Example script
Content type: text/plain
Description: Test file to edit before launching
Class: PDO Database class
Access SQL databases using PDO
Author: By
Last change:
Date: 14 years ago
Size: 536 bytes
 

 

Contents

Class file image Download
<?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 ....');
    
?>