I know this has been covered before, so a faq pointer is ok w/me.

I have this code:

while($db->FetchRow()){
    %Data = $db->DataHash(First_Name,Last_Name);
  foreach $key (sort(keys %Data)) {
          print $key, '=', $Data{$key}, "\n";
  } # end foreach
          print("\n");
}

Now, what appears to be happening is that only one row at a time is
being processed and the other records are not being saved...  In
essence, the %Data hash never contains more than two key/value pairs
(First_Name = John, Last_Name = Smith for instance)...and the next
FetchRow overwrites the current data...

I say this because this code...

while($db->FetchRow()){
    %Data = $db->DataHash(First_Name,Last_Name);
    print("\n");
}

foreach $key (sort(keys %Data)) {
    print $key, '=', $Data{$key}, "\n";
} # end foreach

Only shows the last record in the table, albeit correctly.  

The end result is to sort all the records in the table by last name
before output to screen...

Should I load the contents of %Data into a different hash during each
iteration of the while/fetchrow loop?  Frankly, from the little I know
of working with hashes, I would have thought the first code snippet
would have done it for me correctly...

----------
Ron Powell
Senior IT Analyst &
Network Administrator
gomembers, Inc. (Baltimore Office)
[EMAIL PROTECTED]
410-494-1600 x4058
 



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to