View Single Post
  #4  
Old 06-08-2012, 12:30 AM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 394,432
Hall of Famer is on a distinguished road
Default

Well it is not difficult to instantiate database object, here is how the current database connection is carried out:

PHP Code:
try{
  
$adopts = new Database(DBNAMEDBHOSTDBUSERDBPASSPREFIX);
}
catch(
PDOException $pe){
  die(
"Could not connect to database, the following error has occurred: <br><b>{$pe->getmessage()}</b>");  

The database object accepts five arguments in its constructor, the database name, host, username, password and prefix. You can instantiate as many database objects as you wish by using this syntax below, which assumes that the database name differs but everything else remains the same

PHP Code:
$db1 = new Database(DBNAME1DBHOSTDBUSERDBPASSPREFIX);
$db2 = new Database(DBNAME2DBHOSTDBUSERDBPASSPREFIX);
... 
Hope this helps.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote