On Wed, Jan 16, 2002 at 11:54:27PM -0800, Ida Sze wrote:
> Dear Sir/Madam,
>
> I have the following coding:
>
> line 70: my $sth=$dbh->do("select * from temp where
> ID = '$Staff_ID' and Date = '$Date' and Time !=
> '$Time' order by Time desc");
>
> line 71: while(my @Data=$sth->fetchrow_array) {
> ......
> }
>
> but when i run it, the following error message was
> displayed:
>
> Can't call method "fetchrow_array" without a package
> or subject reference at of.pl line 71, <INPUT> line 1.
Please refer to the docs for DBI:
do
$rc = $dbh->do($statement) || die $dbh->errstr;
$rc = $dbh->do($statement, \%attr) || die $dbh->errstr;
$rv = $dbh->do($statement, \%attr, @bind_values) || ...
Prepare and execute a single statement. Returns the
number of rows affected or undef on error. A return
value of -1 means the number of rows is not known or
is not available.
This method is typically most useful for non-SELECT
statements that either cannot be prepared in advance
(due to a limitation of the driver) or do not need to
be executed repeatedly. It should not be used for
SELECT statements because it does not return a
statement handle (so you can't fetch any data).
Ronald