PHP Classes

File: demo1-connection.php

Recommend this page to a friend!
  Classes of Bob Gombocki   PersistClass   demo1-connection.php   Download  
File: demo1-connection.php
Role: Example script
Content type: text/plain
Description: Creating a DB connection
Class: PersistClass
DB access wrapper & storing objects in DB tables
Author: By
Last change: added web tutorial info
Date: 15 years ago
Size: 467 bytes
 

Contents

Class file image Download
<?php

/*
    http://coolpenguin.net/persistclass
    for updates, documentation, tutorials
*/


require('persistclass/PersistClass.php');

// create a database connection
$myConnection = new DbConnectionMysql();
$myConnection->connect('localhost', 'demouser', 'demopassword', 'demodatabase');

// register connection into DbConnectionPool
DbConnectionPool::instance()->registerConnection($myConnection);

echo
'Successfully connected to database';

?>