I'm creating a CGI that will connect to a MySQL database to read various things. It would make the code cleaner and easier (I thought) if I fetched a hash instead of an array (like usual).
^^ Doesnt print out anything. I've tried many variations of this and the most I can seem to get is a printing of hex numbers that repersent where the hash is in memory I think (whats the correct term for that?).while($info = $sth->fetchrow_hashref) { @case = keys %{info}; print @case; }
^^ Is a snippet of code I found that prints out the results of the SQL query. I thought I understood what this code was doing but since I've had no luck playing with my own I'm guessing I dont understand it like I thought.while ( my $row = $sth->fetchrow_hashref ) { print "New:\n"; foreach my $field ( keys %{ $row } ) { print "$field: $row->{ $field }\n"; }}
What I'm trying to end up having happen is my CGI script will have popup menus. I was wanting those popup menu's populated with entries from the SQL query. To make this easier I thought I would fetch a hash, dump all of the values from the hash into an array and use that array to in the popup menu.
Any advice or information anyone can spare would be wonderful.
In reply to DBI fetchrow_hashref issue by jorvic
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |