On Fri, 23 Feb 2001 01:48:07 -0000, "David Jacobowitz"
<[EMAIL PROTECTED]> wrote:
David,
Wouldn't this work:
while ($ref = $sth->fetchrow_hashref) {
foreach $key (keys %{$ref}) {
print �$key------ $ref->{$key}, �;
}
>>Spend few hours trying to figureout a way to print my field name with the
>>returned field value without any success. Looked in the websites but no
>>clue. Below is my code can anyone modify the code so it will print
>>field_name_in_mysql_table and field_values that is in mysql? I have 5
>>fields in my table.
>>
>>.
>>.
>>.
>>my $dbh = DBI->connect ( "DBI:mysql:test:localhost", "test", "*******",
>>{
>> PrintError => 0,
>> RaiseError => 0
>>}) or die "Can't connect to the database: $DBI::errstr\n";
>>
>>my $sth = $dbh->prepare( "
>>SELECT * FROM incu_management WHERE person_id=1001 " )
>> or die "can't preare SQL statement: $DBI::errstr\n";
>>
>>$sth->execute ();
>>
>>while ($ref = $sth->fetchrow_hashref) {
>> foreach $key (keys %{$ref}) {
>> print �$field_name(need help here)------ $ref->{$key}, �;
>> }
Thunder Rain Internet Publishing
Providing Internet Solutions that work!
http://www.thunder-rain.com
Tel: 1(225) 686-2002