List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:August 23 2001 11:03pm
Subject:Re: Does anyone know why fetchrow_hashref failed?
View as plain text  
At 1:09 PM -0700 8/23/01, Truoc Duong wrote:
>Hi,
>
>I am using mod_perl and MySQL 3.23.38 on Red Hat Linux
>6.2 and my following codes occasionally got an error.
>
>    $SQL = 'SELECT col1,col2 FROM table1'.
>           ' WHERE keya=1 AND keyb=2';
>    $STH = $DBH->prepare($SQL) || die $SQL;
>    if ($STH->execute() >= 1) {
>        $rec = $STH->fetchrow_hashref;
>        $STH->finish();
>    }
>
>The error was:
>
>DBD::mysql::st fetchrow_hashref failed: fetch()
>without execute() at program-name line ####.

Looks to me like it would be impossible for fetchrow_hashref() to be
executed without execute() having first been called, because the
test in the if() requires execute() to be called before the test
can be evaluated.  Do you have another fetchrow_hashref() call somewhere?

However, execute() returns undef or true for a SELECT statement, not
a row count.  You seem to be using it as though it returns a row count.

>
>It only happened once in a few dozen transactions.  If
>  anyone knows the cause of this and knows the solution
>for it, please let me know.
>
>Thank you very much in advance.
>
>Truoc Duong.
>
>__________________________________________________
>Do You Yahoo!?
>Make international calls for as low as $.04/minute with Yahoo! Messenger
>http://phonecard.yahoo.com/
>
>---------------------------------------------------------------------
>Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
>To request this thread, e-mail <mysql-thread83465@stripped>
>To unsubscribe, e-mail <mysql-unsubscribe-##L=##H@stripped>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


-- 
Paul DuBois, paul@stripped
Thread
Does anyone know why fetchrow_hashref failed?Truoc Duong23 Aug
  • Re: Does anyone know why fetchrow_hashref failed?Paul DuBois24 Aug