|P is for Practical|
fetchrow_hashref within a loop yields "fetch() without execute()"by Jazz (Curate)
|on Oct 30, 2009 at 22:36 UTC||Need Help??|
Jazz has asked for the wisdom of the Perl Monks concerning the following question:
Update: The second I posted this, I noticed that the while statement is making the fetchrow go out of scope (d'uh!). So the updated question is what is the most efficient/elegant way to achieve the structure that I need without it going out of scope?
I'm receiving the "DBD::mysql::st fetchrow_hashref failed: fetch() without execute() " error when invoking fetchrow_hashref within loops. First the code:
$fields is going to get tossed to HTML::Template for some happy TMPL_LOOP nesting, which is why I need this data structure.
If I pull the while statement outside of the foreach loops, it works fine. What is it about being inside the loop that makes this error come up, and how can I fix it, oh wise ones?