List:General Discussion« Previous MessageNext Message »
From:Adam Powell Date:July 9 1999 11:37pm
Subject:Re: [PHP3] simultaneous connections to mySQL
View as plain text  
Hi, thanks for the response... its just that if I wanted to do this within
one script, is there any way to process one command before the previous one
has executed.  I know it is possible to hold open connections
simultaneously, but since PHP is interpreted, is it is possible to do
'background processes' like a fork() command in C?

For instance..  what would be the quickest way of getting from point A to
point B within a single script without intepreting each line consecutively?
We want to open the connection to server 1 and 2 at the same time, and
finish up when both have returned their results... we dont want to open the
first, get result, then open the second, get result if you know what I mean.

// Point A
mysql_connect(server 1);
$res = mysql("$DB_NAME", "SELECT username FROM personal");
$user1 = mysql_result($res, 0, 0);
mysql_connect(server 2);
$res = mysql("$DB_NAME", "SELECT username FROM personal");
$user2 = mysql_result($res, 0, 0);
// Point B

Adam

----- Original Message -----
From: Rasmus Lerdorf <rasmus@stripped>
To: Adam Powell <adam@stripped>
Cc: <php3@stripped>; <mysql@stripped>
Sent: Saturday, July 10, 1999 8:03 AM
Subject: Re: [PHP3] simultaneous connections to mySQL


> > For an application that I am writing, one of the ideas I have is only
> > possible if I can create two (or more) seperate connections to a
database at
> > the same time.  I have been told that this is possible using mod_perl,
> > however I was wondering if such a thing had been implemented in PHP.
> > Basically, time is of the essence, and the main things slowing down data
> > retrieval are connection times... so we want to get them all done
> > simultaneously.
>
> You can have as many concurrent connections as you want.  They can even
> span different databases.  As in, you can have 5 MySQL connections, 3
> Oracle, 18 Sybase and 500 DB2 connections...
>
> -Rasmus
>
>

Thread
simultaneous connections to mySQLAdam Powell10 Jul
  • Re: [PHP3] simultaneous connections to mySQLRasmus Lerdorf10 Jul
    • Re: [PHP3] simultaneous connections to mySQLAdam Powell10 Jul
      • Re: [PHP3] simultaneous connections to mySQLRasmus Lerdorf10 Jul
  • Re: simultaneous connections to mySQLJunster11 Jul