http://qs321.pair.com?node_id=430494


in reply to Perl/MySQL

You'll find it easier to user fetchrow_hashref for this purpose, like this:
while ($row=$sth->fetchrow_hashref) { foreach $col (%{$row}) { print "$col: ".$$row{$col}."\n"; } }
Edit: I made a stupid mistake: it should be
foreach $col (keys %{$row}) {

Replies are listed 'Best First'.
Re^2: Perl/MySQL
by Anonymous Monk on Feb 15, 2005 at 14:12 UTC
    Thanks for all your help.

    I have found a small problem in the code suggested by majita. It appears to print the field name and the value, then on the next line, it prints the value again?

    Name: tony tony: Address: 10 downing st 10 downing st: Tel: 00000000000 000000000: Email: tony@no10.co.uk tony@no10.co.uk:

    wheres the problem?

    Cheers, Marcel