Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Perl/MySQL

by matija (Priest)
on Feb 12, 2005 at 20:34 UTC ( #430494=note: print w/ replies, xml ) Need Help??


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}) {


Comment on Re: Perl/MySQL
Select or Download Code
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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://430494]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (16)
As of 2015-07-31 18:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (280 votes), past polls