in reply to Re^2: Not an ARRAY reference Error Help!
in thread Not an ARRAY reference Error Help!
Check out the 'You may often want to fetch an array of rows where each row is stored as a hash' section of the DBI documentation.my $dbh = database->connect_mysql(); my $sql = "select * FROM mytable WHERE date < DATE_ADD(NOW(), INTERVAL -30 DAY)"; my $records = $dbh->selectall_arrayref( $sql, { Slice => {} } ); foreach my $record ( @$records ) { my $user = $record->{user}; my $id = $record->{id}; print "Data Test: $user - $id<br>"; }
|
|---|