On Wed, Feb 06, 2002 at 01:57:21PM +0000, Wiliam Stephens wrote:
> Hi
> 
> I want to retrieve a row of MySQL data using Perl and DBI, so I do it like 
> this:
> 
> [code]
>          my $sqlquery = qq|SELECT * FROM ata_members WHERE id=$id|;
>          $sth = $dbh->prepare($sqlquery);
>          $sth->execute or die("Can't execute SQL query. [$DBI::err] 
> $DBI::errstr");
>          $ref = $sth->fetchrow_hashref();
>          $sth->finish;
> [/code]

Seems reasonable.

> But what I want is to populate a %hash with all name/value pairs
> retruned from this query.

Are you sure that there is data returned?

> I tried:
> 
> [code]
>          my %hash = %$ref;
> [/code]
> 
> But that doesn't work.

It should.  I'm not sure why you'd want to do it, but it should work.

Jeremy
-- 
Jeremy D. Zawodny, <[EMAIL PROTECTED]>
Technical Yahoo - Yahoo Finance
Desk: (408) 349-7878   Fax: (408) 349-5454   Cell: (408) 685-5936

MySQL 3.23.41-max: up 2 days, processed 100,373,948 queries (475/sec. avg)

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to