Ignore:
Timestamp:
Oct 29, 2006, 7:10:34 PM (13 years ago)
Author:
Dominic Hargreaves
Message:

Add last 5 postcodes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/npemap.org.uk/perllib/NPEMap/Postcodes.pm

    r230 r235  
    4545    my $sth = $dbh->prepare($sql);
    4646    $sth->execute();
    47     return $sth->fetchrow_hashref;
     47    return $sth->fetchall_arrayref({});
     48}
     49
     50sub _getLastPostcodes {
     51    my $dbh = shift;
     52    my $num = shift;
     53    my $sql = <<"HERE";
     54SELECT easting, northing, outward, inward, TO_CHAR(created_at, 'DDth Mon HH24:MI')AS date
     55FROM postcodes
     56WHERE NOT deleted
     57ORDER BY created_at DESC LIMIT ?
     58HERE
     59
     60    my $sth = $dbh->prepare($sql);
     61    $sth->execute($num);
     62    return $sth->fetchall_arrayref({});
    4863}
    4964
     
    6378    my $allStats = _getAllStats($dbh);
    6479    my $dateStats = _getDateStats($dbh);
     80    my $lastPostcodes = _getLastPostcodes($dbh, 5);
    6581
    6682    my $vars = {
    6783        allstats => $allStats,
    68         datestats => $dateStats
     84        datestats => $dateStats,
     85        lastpostcodes => $lastPostcodes
    6986    };
    7087   
Note: See TracChangeset for help on using the changeset viewer.