Hi all,
i'm having some trouble fetching and making query trough a loop. (sorry for
my bad english)
to explain , please read the example :
suppose to have 100 bugs unsolved.
$stmt = $db->query('SELECT * FROM bugs');
while ($row = $stmt->fetch()) {
echo $row['bug_description'].'<br/>';
}
we should see all numbers from 1 to 100, and it's ok.
But if I want to update the bug status as the next example, the loop exit
(with no error) after the first cycle.
I know it's a very trivial example, but i think is better to solve a problem
with stupid example easy to reproduce :)
$stmt = $db->query('SELECT * FROM bugs');
while ($row = $stmt->fetch()) {
echo $row['bug_id'].'<br/>';
//some login to check bug solved
$db->query('UPDATE bugs SET solved = 1 WHERE bug_id = '.$row[bug_id']);
}
The loop stop with no error at first cycle, only first record updated.
Thank you for support.
--
View this message in context:
http://www.nabble.com/Using-fetch%28%29-in-a-loop%2C-internal-query-doesn%27t-work-tp23656095p23656095.html
Sent from the Zend Framework mailing list archive at Nabble.com.