Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Thanks for looking!... my $dbh = database->connect_mysql(); my $sql = "select * FROM mytable WHERE date < DATE_ADD(NOW(), INTERVA +L -30 DAY)"; my $sth = $dbh->prepare($sql) or "Can't select from table: ",$dbh->err +msg; $sth->execute(); my $data = $sth->fetchrow_hashref(); # <- this line x for (my $i = 0; $i < @{$data}; $i++) { my $user = $data->[$i]{'user'}) || ''; my $id = $data->[$i]{'id'}) || ''; print "Data Test: $user - $id<br>"; } .... #Not an ARRAY reference at line x. Error
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Not an ARRAY reference Error Help!
by Limbic~Region (Chancellor) on Jan 13, 2011 at 19:02 UTC | |
by Anonymous Monk on Jan 13, 2011 at 19:32 UTC | |
by Limbic~Region (Chancellor) on Jan 13, 2011 at 19:49 UTC | |
by derby (Abbot) on Jan 13, 2011 at 19:47 UTC | |
|
Re: Not an ARRAY reference Error Help!
by ww (Archbishop) on Jan 13, 2011 at 19:00 UTC | |
|
Re: Not an ARRAY reference Error Help!
by andmott (Acolyte) on Jan 13, 2011 at 20:12 UTC |