All pastes #137030 Raw Edit

Miscellany

public text v1 · immutable
#137030 ·published 2006-08-18 02:43 UTC
rendered paste body
#
# List of cols from SQL to group the sessions by.  Each additional group added will
# become a subgroup of the group above it.
#
$group[0] = "State";
$group[1] = "City";

my @last_group = ();
$path = $session_path;

while( $hash = $sth->fetchrow_hashref() ) {
  
  for ($i=0; $i<scalar(@group); $i++) {
    if ($last_group[$i] ne $hash->{$group[$i]}) {
      $path = $session_path;
      for ($j=0; $j<$i+1; $j++) {
        $path = $path . "\\" . $hash->{$group[$j]};
      }
      mkdir($path);
      print "$group[$i]: " . $hash->{$group[$i]} . "\n";
    }