Re: Query refuses to recurse all rows {RESOLVED]

From: Date: Thu, 29 May 2008 02:36:52 +0000
Subject: Re: Query refuses to recurse all rows {RESOLVED]
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-274794@lists.php.net to get a copy of this message
Thanks Wolf and Chris, That did the trick -- now I just have to clean up the order a bit. Amazing how another's view can see the problem so clearly -- I was way too close, what with otehr coding - should've seen it! Regards, Andre (celtic) On Wednesday 28 May 2008, Wolf wrote: > Chris wrote: > >> $numrows1 = pg_numrows($result1); > >> $row = 0; > >> do > >> { > >> $myrow = pg_fetch_array($result1, $row); > > > > <snip> > > > >> $numrows2 = pg_numrows($result2); > >> $row = 0; > >> do > >> { > >> $myrow = pg_fetch_array($result2, $row); > > > > You're overwriting your variables. > > > > $myrow from result 1 is being killed off when it gets into the $myrow > > loop from result 2. > > Yeah, what Chris said! > > When you are looping inside another piece, make sure to change up all > your variables. > use a $j inside an $i, a $l inside a $k, $rowa inside a $row > > Woulda saved yourself a day of playing... > > Remember, the variable scope changes inside a function or class, but > outside of that they pretty much run the whole length of the script. > > HTH, > Wolf

« previous php.general (#274794) next »