fetch() without execute() error
fetch() without execute() error
am 18.07.2002 10:40:53 von Matt Wagner
Hey everyone,
Keep getting an error via Crontab, which I don't understand. The error I
keep getting is:
DBD::mysql::st fetchrow_array failed: fetch() without execute() at
I know what the error means, but don't understand it. I looked at the code,
and an execute() is performed before fetch(). Here's the code:
-----------------------------
## Execute the SQL statement
$sth = $$self->prepare($sql);
$rv = $sth->execute or &error(311, __LINE__, __FILE__, $sql);
return undef unless $rv > 0;
## Parse the results
while (@row = $sth->fetchrow_array) {
push @query_results, [ @row ];
}
-----------------------------
Of course, $$self is a DB handle. Any ideas of why this would not be
working?
Thanks,
Matt
------------------------------------------------------------ ---------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail msql-mysql-modules-thread1864@lists.mysql.com
To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail msql-mysql-modules-unsubscribe@lists.mysql.com instead.
Re: fetch() without execute() error
am 18.07.2002 19:11:11 von fision
Hello,
I don't know why your code fails, but 'execute' method returns 'undef'
on error, so you have to check the return value against 'undef', like
this:
return undef unless defined $rv;
fision
On Thu, 2002-07-18 at 05:40, Matt Wagner wrote:
>
> Hey everyone,
>
> Keep getting an error via Crontab, which I don't understand. The error I
> keep getting is:
>
> DBD::mysql::st fetchrow_array failed: fetch() without execute() at
>
> I know what the error means, but don't understand it. I looked at the code,
> and an execute() is performed before fetch(). Here's the code:
>
>
> -----------------------------
>
> ## Execute the SQL statement
> $sth = $$self->prepare($sql);
> $rv = $sth->execute or &error(311, __LINE__, __FILE__, $sql);
> return undef unless $rv > 0;
>
> ## Parse the results
> while (@row = $sth->fetchrow_array) {
> push @query_results, [ @row ];
> }
>
> -----------------------------
>
> Of course, $$self is a DB handle. Any ideas of why this would not be
> working?
>
> Thanks,
> Matt
>
>
>
> ------------------------------------------------------------ ---------
> Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
> posting. To request this thread, e-mail msql-mysql-modules-thread1864@lists.mysql.com
>
> To unsubscribe, send a message to the address shown in the
> List-Unsubscribe header of this message. If you cannot see it,
> e-mail msql-mysql-modules-unsubscribe@lists.mysql.com instead.
>
------------------------------------------------------------ ---------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail msql-mysql-modules-thread1865@lists.mysql.com
To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail msql-mysql-modules-unsubscribe@lists.mysql.com instead.
Re: fetch() without execute() error
am 18.07.2002 19:11:11 von fision
Hello,
I don't know why your code fails, but 'execute' method returns 'undef'
on error, so you have to check the return value against 'undef', like
this:
return undef unless defined $rv;
fision
On Thu, 2002-07-18 at 05:40, Matt Wagner wrote:
>
> Hey everyone,
>
> Keep getting an error via Crontab, which I don't understand. The error I
> keep getting is:
>
> DBD::mysql::st fetchrow_array failed: fetch() without execute() at
>
> I know what the error means, but don't understand it. I looked at the code,
> and an execute() is performed before fetch(). Here's the code:
>
>
> -----------------------------
>
> ## Execute the SQL statement
> $sth = $$self->prepare($sql);
> $rv = $sth->execute or &error(311, __LINE__, __FILE__, $sql);
> return undef unless $rv > 0;
>
> ## Parse the results
> while (@row = $sth->fetchrow_array) {
> push @query_results, [ @row ];
> }
>
> -----------------------------
>
> Of course, $$self is a DB handle. Any ideas of why this would not be
> working?
>
> Thanks,
> Matt
>
>
>
> ------------------------------------------------------------ ---------
> Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
> posting. To request this thread, e-mail msql-mysql-modules-thread1864@lists.mysql.com
>
> To unsubscribe, send a message to the address shown in the
> List-Unsubscribe header of this message. If you cannot see it,
> e-mail msql-mysql-modules-unsubscribe@lists.mysql.com instead.
>
------------------------------------------------------------ ---------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail msql-mysql-modules-thread1865@lists.mysql.com
To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail msql-mysql-modules-unsubscribe@lists.mysql.com instead.