Problems with multiple query
| From: | Luca Lazzeroni | Date: | Sun, 18 Mar 2001 18:49:45 +0000 |
| Subject: | Problems with multiple query | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-44447@lists.php.net to get a copy of this message | ||
Hi,
I've recently migrated a system with PHP 4.0.3pl1 and PostgreSQL 7.0.2 -
RedHat Linux 5.1 (yes 5) to a new one with PHP 4.0.4pl1 - PostgreSQL 7.0.2 -
RedHat Linux 7.0.
All my database applications work fine except one which does strange things:
this is a piece of code:
----8<------- CUT ----
$conn = pg_connect("dbname=aaaa user=yyyyy password=xxxxxx");
$sql = "select * from table_a where condition_a";
$qry1 = pg_exec ($conn,$sql);
$obj1 = pg_fetchobject($qry1,0);
// Until here everything works fine
$sql2 = "select * from table_b where condition_b=".$obj1->value_a;
$qry2 = pg_exec ($conn,$sql2);
----8<------- CUT ----
The second query is nested in a for-loop running for every object in the
first query; for performance reason I need to maintain the two queries
independent.
After executing (correctly) the first one, the system starts doing strange
things with the second one:
Warning: Unable to jump to row 0 on PostgreSQL result index 23 in cerca.php3
on line 467
and it fails to read data.
The strange thing is that the system does the same things for EVERY database
where I must use two consecutive queries !
Is there anyone who can help me ?
Thanks in advance
Luca Lazzeroni