I'd like to know the method to connect and query multiple databases in
the same php script ...

I've to do something like this :

do query on db1_on_server_1
        while( get results of query on db1_on_server_1){
                do query on db2_on_server_2

the structure of the db is this one :

# Table structure for table 'attendees' in db 'training2'
CREATE TABLE attendees (
   attendee_ID int(8) NOT NULL auto_increment,
   training_requester_ID int(8),
   PRIMARY KEY (attendee_ID),
   UNIQUE attendees_ID (attendee_ID)

# Dumping data for table 'attendees'
INSERT INTO attendees (attendee_ID, training_requester_ID) VALUES (
'1', '299');

# Table structure for table 'people_info' in db 'octopus'
CREATE TABLE people_info (
   id int(255) DEFAULT '0' NOT NULL,
   l_name varchar(255) NOT NULL

# Dumping data for table 'people_info'
INSERT INTO people_info (id, l_name) VALUES ('299', 'Forseilles');

I've tried the following script, but it gives me a 'Warning: Supplied
argument is not a valid MySQL result resource in
g:\htdocs\training\viewmytrainings.php on line 23' :



function connect($database){
        $array=explode(",", $database);

        $connect=mysql_connect($host,$user,$pass) or die ("unable to
connect host $host<br>");
        mysql_select_db($db) or die ("unable to select $db in


$query="select * from attendees order by training_ID asc";
$result=mysql_query($query, $connect1);

echo "$row[1]";

$queryx="select l_name from people_info where id='$row[1]'";
$resultx=mysql_query($queryx, $connect2);

echo "$rowx[0]";


Any idea ? Thanks for your help ...

(PHP Version 4.0.6)

d3crypt aka p
$ drink <bottle; opener
bottle: cannot open
opener: not found

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to