Re: multiple databases

From: Date: Wed, 16 Jul 2003 03:56:20 +0000
Subject: Re: multiple databases
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-155361@lists.php.net to get a copy of this message
On Jul 16, 2003, "Paulo Neves" claimed that: |Hi, | |How can I set up PHP to work with multiple databases in the same page? |(not tables) | |That's all, | |Thanks | |PN | How do you work with multiple variables in the same page? <? $database1_link = mysql_connect('localhost', 'user', 'password'); mysql_select_db('database1', $database1_link); $database2_link = mysql_connect('localhost', 'user', 'password'); mysql_select_db('database2', $database2_link); $result1 = mysql_query("SELECT * WHERE 1=1", $database1); $result2 = mysql_query("SELECT * WHERE foo = 'banana split'", $database2); require_once ('DB.php'); $dblink=DB::connect("oci8://user:password@example.net"); $insert = $dblink->query("INSERT INTO useronline VALUES (3, 4, 'Joe Momma'"); ?> The key is either to use DB.php and define different hooks, or to use the second argument of your _query function. Jeff Harris -- Registered Linux user #304026. "lynx -source http://jharris.rallycentral.us/jharris.asc | gpg --import" Key fingerprint = 52FC 20BD 025A 8C13 5FC6 68C6 9CF9 46C2 B089 0FED Responses to this message should conform to RFC 1855.

« previous php.general (#155361) next »