PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of James Glenlake  >  SmashDB  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: An example of how to use SmashDB
Class: SmashDB
Database abstraction with support to many RDBMS
Author: By
Last change: Removed my login details
Date: 11 years ago
Size: 470 bytes
 

Contents

Class file image Download
<?php

require 'db.php';

$db = new Database('mysql', 'localhost', 'username', 'password', 'database');
$query = $db->Query('select * from table');

$querytext = $db->Queries($db->mQueryCount);

print
'Output generated by this query: '.$querytext.'<br>';

print
'<table>';

while (
$row = $db->FetchAssoc($query))
{
    print
'<tr>';
    foreach (
$row as $key=>$val)
    {
        print
'<td>'.$key.': '.$val.'</td>';
    }
    print
'</tr>';
}

print
'</table>';

?>