On Mon, 2002-09-02 at 11:37, Harald Fuchs wrote:
> In article <1030961610.8175.5.camel@pascal>,
> Martin Waite <[EMAIL PROTECTED]> writes:
> 
> > Hi,
> > You need to use two separate database and statement handles - you can 
> > only have one active query per handle.
> 
> > eg.
> 
> > $dbh1 = DBI->connect(...);
> > $dbh2 = DBI->connect(...);
> 
> > $sth1 = $dbh1->prepare( ... );
> > $sth1->execute(...);
> 
> > while ( $sth1->fetch() ) {
> >     $sth2 = $dbh2->prepare( ... );
> >     $sth2->execute(...);
> >     while ( $sth2->fetch() ) {
> >     }
> > }
> 
> Nope.  You can have multiple active statement handles per database handle.
> 

Harald is correct (- thanks), but you still need a separate statement
handle for the query inside the loop:

$dbh1 = DBI->connect(...);

$sth1 = $dbh1->prepare( ... );
$sth1->execute(...);

while ( $sth1->fetch() ) {
        $sth2 = $dbh1->prepare( ... );
        $sth2->execute(...);
        while ( $sth2->fetch() ) {
        }
}



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to