Anonymous | Login | Signup for a new account | 11-24-2024 13:15 PST |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ Issue History ] [ Print ] | |||||||||||
ID | Category | Severity | Reproducibility | Date Submitted | Last Update | |||||||
0003822 | [Quercus] | block | always | 12-20-09 19:46 | 12-21-09 05:23 | |||||||
Reporter | domdorn | View Status | public | |||||||||
Assigned To | ||||||||||||
Priority | normal | Resolution | open | |||||||||
Status | new | Product Version | 4.0.2 | |||||||||
Summary | 0003822: Variable scoping issues in loops!!!! | |||||||||||
Description |
I have lots of code like this: while(list($dnow, $nusernr, $stitle, $stext, $nuserguestbooknr,$nstatusnr) = $rSQLGetEntries->fetchRow() ) { include("$sDocumentRoot/ly/tmpl/elements/dsp_GuestbookEntry.php"); unset($dnow, $nusernr, $stitle, $stext, $nuserguestbooknr,$nstatusnr); } where $rSQLGetEntries is a Pear::DB Object and fetchRow() is a method, returning an array (see http://pear.php.net/manual/en/package.database.db.db-result.fetchrow.php [^] ) this code does not work, because the list expression is not implemented correctly OR the scoping of variables in Loops is broken! I've narrowed it down to something like this (10 is the correct number of rows returned) for($i = 0; $i < 10; $i++) { $res = $rSQLGetEntries->fetchRow(); print_r($res); echo "<hr/>"; } this correctly executes print_r on each of the 10 rows... however, as soon as I do this: for($i = 0; $i < 10; $i++) { $res = $rSQLGetEntries->fetchRow(); print_r($res); echo "<hr/>"; $dnow = $res[0]; } the code stops after the first loop execution |
|||||||||||
Additional Information | ||||||||||||
Attached Files | ||||||||||||
|
Issue History | |||
Date Modified | Username | Field | Change |
12-20-09 19:46 | domdorn | New Issue | |
12-21-09 05:23 | domdorn | Note Added: 0004362 |
Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
28 total queries executed. 25 unique queries executed. |