At 01:08 PM 9/3/2003 -0400, Michael Ragsdale wrote:
>At 12:43 PM 9/3/2003, NIPP, SCOTT V (SBCSI) wrote:
>> I keep coming up with this error, but I AM performing an execute
>>prior to the fetch. I have seen some other threads on this, and have
>>upgraded the DBD:Mysql to the latest version on CPAN. Any ideas? Here is a
>>small portion of the code:
>>
>>if ($rows2 == 1) {
>> my $vals = $test2->fetchrow_hashref ('NAME_lc');
>> my $id = $vals->{id};
>> my $query = $dbh2->prepare("SELECT * FROM fsdata WHERE id ='$id'");
>> $query->execute();
>> $query->finish();
>> while (my $ref2 = $query->fetchrow_hashref ('NAME_lc')) {
>> undef $set2;
>>
>> I am getting an error on the fetchrow_hashref line. Thanks in
>>advance.
>>
>>Scott Nipp
>>Phone: (214) 858-1289
>>E-mail: [EMAIL PROTECTED]
>>Web: http:\\ldsa.sbcld.sbc.com
>
>Don't call finish() until you are done with your execute() - place it AFTER your
>while statement. finish() doesn't kill the statement handle, but it does kill the
>current execute() - it frees up the buffer space where your data resides and you
>haven't yet retrieved it from that buffer.
That would be okay if the execute were running once. It may not be. First thing, move
the finish() out of the loop, then enable some error checking, like RaiseError => 1 in
the connect and see if the execute() is working at all! If the execute fails then at
least you will know and you can fix that before you worry about fetching data.
John