PHPLib - handle queries simultaniously?

wxdqz

New Member
Dear PHP-Pros,

I just started to implement the DBI of the PHP-Libraries in a project as preparation for a later move from MySQL to Postgres ..

I am now confronted with a problem:

old version, which works:
-snip-
$result=mysql_query("...");
WHILE(mysql_fetch_array($result)){
...
...
$result2=mysql_query("...");
WHILE(mysql_fetch_array($result2)){
...
...
}
}
-snip-

When using the DB_SQL-Class, it does not work ..
-snip-
$db=new $DB_anything;
$result=$db->query("...");
WHILE($db->next_record($result)){
...
...
$result2=$db->query("...");
WHILE($db->next_record($result2)){
...
...
}
}
-snip-

When $result2 is queried, it is not possible to return to $result when jumping to the beginning of the first WHILE-Loop.

One Solution is to create arrays an run the outer loop with an array instead of the query, but this sucks, especially with more data in the query of the outer loop.

An other Solution is to create a new object for each query in nested loops ($db1, $db2, ..)

I assume, this causes heavy server load, that's why I ask if anybody knows, if it is possible to handle more than one query concurrent with on PHPLIB-DB-Instance or with any other PHP-DBI (Metabase?)

thx for Tips
 
Back
Top