0% found this document useful (0 votes)
9 views

Data Hash

This document describes the DataHash method which retrieves data from a previous database query into a hash where the field names are keys. It returns a hash of the specified field names and values from the last row fetched, or all fields if none are specified. An example shows retrieving specific fields into a hash and printing one value, or getting all fields without parameters to iterate over the hash.

Uploaded by

Amutha Arun
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Data Hash

This document describes the DataHash method which retrieves data from a previous database query into a hash where the field names are keys. It returns a hash of the specified field names and values from the last row fetched, or all fields if none are specified. An example shows retrieving specific fields into a hash and printing one value, or getting all fields without parameters to iterate over the hash.

Uploaded by

Amutha Arun
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

DataHash

DataHash list
Retrieve data from previous fetch for a list of field names. Returns a hash where the field name is the key.
If no field names are given, all fields are returned.

Example:
$db->Sql("SELECT f1, f2, f3 FROM foo");
$db->FetchRow();
%hash = $db->DataHash("f1", "f2");
print $hash{f1};
or
$db->Sql("SELECT * FROM foo");
$db->FetchRow();
%hash = $db->DataHash;
foreach $key (sort(keys %hash)) {
print $key, '=', $hash{$key}, "\n";
}
See also: Data

You might also like