Re: [phplib] Multiple Schemas From: nathan r. hruby (nathan <email protected>)
Date: 06/29/01

On Fri, 29 Jun 2001, White, Bob wrote:

> Hi All,
> I am looking for suggestions for setting up multiple schemas using PHP4,
> phplib , Apache, Oracle 8.1.6. Here is the scenario. I would like to have
> separate tables for each user (project) I would like to have a universal
> set of php scripts that accessed the same tables under different projects.
> Can I have multiple instances of DB_Sql open at the same time? Can they
> both be declared in local.inc? How is this normally done?
>

Yes, just make a new subclass of DB_Sql for each project that you have.

class Project1DB extends DB_Sql {

   var $classname ="Project1DB";
   var $Host = "localhost";
   var $Database = "project1";
   var $User = "project1";
   var $Password = "project1";
}

class Project2DB extends DB_Sql {

   var $classname = "Project2DB";
   var $Host = "localhost";
   var $Database = "project2";
   var $User = "project2";
   var $Password = "project2";
}

Then in your script just do:

$p1db = new Project1DB;
$p2db = new Project2DB;

Remember the if there are diffrent databases, and you plan on ussing
Session that each db should have seperate username / password pairs or php
will reuse the last connection and Session stuff will fail during
page_close().

-n

-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
nathan hruby / digital statement
nathan <email protected>
http://www.dstatement.com/

Public GPG key can be found at: http://www.dstatement.com/nathan-gpg-key.txt ED54 9A5E 132D BD01 9103 EEF3 E1B9 4738 EC90 801B -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

--------------------------------------------------------------------- To unsubscribe, e-mail: phplib-unsubscribe <email protected> For additional commands, e-mail: phplib-help <email protected>