PHP Classes

File: Example.php

Recommend this page to a friend!
  Classes of Torben K.   Jade Dbo   Example.php   Download  
File: Example.php
Role: Example script
Content type: text/plain
Description: A simple example
Class: Jade Dbo
Database abstraction layer with drivers
Author: By
Last change:
Date: 13 years ago
Size: 652 bytes
 

Contents

Class file image Download
<?php

include 'Dbo.php';

$cstring = 'host=localhost;user=mysql;password=mysql123;database=mydb;persistent=true';

$sql = Dbo::connect( $cstring, 'MySql' );

echo
'<pre>';
print_r( $sql->query( 'select * from mytable' )->fetchAll() );
echo
'</pre>';


function
myfunction( $arg ) {
     return
Dbo::getHandle()->query( 'select '.$arg.' from mytable' )->fetch();
}

/* Multiple databases possible */

$cstring2 = 'host=127.0.0.2;user=mysql;password=mysql123;database=mydb;persistent=true';

Dbo::connect( $cstring2, 'MySql', 'scon' );

print_r( Dbo::getHandle( 'scon' )->query( 'select * from myothertable' )->fetchAll() );

?>