Have you tried to put your code in a try-catch statement? Have you tried print all the query that are supposed to be executed and run them from phpmyadmin? Did you get any errors? Maybe if you post your code we can help.
Sorry for all these questions, I just want to help :) Sergio Rinaudo > Date: Fri, 22 May 2009 15:58:12 -0700 > From: [email protected] > To: [email protected] > Subject: RE: [fw-general] Using fetch() in a loop, internal query doesn't work > > > Thanks for answer, > what i wrote is only an example, no parse error on the code i'm testing or > query error ;) > I tried all, many times, many days ago (and now to be sure..) all without > success. > $db->query > $db->update > or table model, neither works, the loop exit after first cycle with no > errors, simply it make first update then exit from loop and the script > continue it's work. > > I tested it on all zend version from 1.6 to 1.8 > > .....lost...... > > :-(( > > Razorblade wrote: > > > > > > I advice you to try the update method > > > > $data = array( > > 'solved' => 1 > > ); > > $where[] = "bug_id = '".$row['bug_id']."' "; > > $db->update($yourTableName,$data,$where); > > > > Or if you have your table model instancied > > > > > > $myTableModel->update($data,$where); > > > > and also, did you notice that the var $row[bug_id'] is missing a ' ? > > > > Bye > > > > Sergio Rinaudo > > > > > > > >> Date: Fri, 22 May 2009 15:09:03 -0700 > >> From: [email protected] > >> To: [email protected] > >> Subject: Re: [fw-general] Using fetch() in a loop, internal query doesn't > >> work > >> > >> > >> > >> chrisweb wrote: > >> > > >> > > >> > you could do it like this: > >> > > >> > $stmt = $db->query('SELECT * FROM bugs LIMIT 100'); > >> > > >> > $rows = $stmt->fetchAll(); > >> > > >> > foreach ($rows as $row) { > >> > > >> > $db->query('UPDATE bugs SET solved = 1 WHERE bug_id = > >> > '.$row[bug_id']); > >> > > >> > } > >> > > >> > > >> > >> Thank you for answer, > >> I know I can use fetchAll() method, but i have to use fetch() due the > >> fact > >> fetchAll() can be a memory killer. > >> If I have a large amount of data (csv export, mass mailing send and so > >> on) I > >> have to forgive fetchAll to prevent out of memory problem. > >> So I'm diggin to find a way to use query inside a fetch loop.....my > >> opinion > >> is that it's a big bug on zend side. > >> All db layer i used can do this...i can't believe that zend_db cannot > >> manage > >> this type of operations. > >> > >> maybe i should fill a bug report? > >> > >> Thank you > >> > >> > >> -- > >> View this message in context: > >> http://www.nabble.com/Using-fetch%28%29-in-a-loop%2C-internal-query-doesn%27t-work-tp23656095p23678642.html > >> Sent from the Zend Framework mailing list archive at Nabble.com. > >> > > > > _________________________________________________________________ > > Cerca le Parole, gioca su Typectionary! > > http://typectionary.it.msn.com/ > > > > -- > View this message in context: > http://www.nabble.com/Using-fetch%28%29-in-a-loop%2C-internal-query-doesn%27t-work-tp23656095p23679133.html > Sent from the Zend Framework mailing list archive at Nabble.com. > _________________________________________________________________ Più di 30 stazioni. Ascolta la Radio su Messenger! http://messenger.it/radioMessenger.aspx
