Link to home
Start Free TrialLog in
Avatar of dreamshockDesign
dreamshockDesign

asked on

Setting all fields in a hash to name/value from sql...

Hi there,

I am just moving code from one server to another, where my current code uses the following syntax to get all the variables returning from the sql output (saves defining each time)....

                while( $hash =  $sth->fetchrow_hashref() )
                          {
                                           foreach( keys %$hash ){
                             $$_ = $hash->{$_}
                                 }

However now the server uses the folowing syntax, and I am not sure how to convert the statement above to "catch all" the output ......

      while (%hash = $sth->fetchhash)
      {
            $pagetemplate=$hash{'pagetemplate'};
            $fulltitledisplay=$hash{'fulltitle'};
            $pageviews=$hash{'pageviews'};
      }

can someone help me out please!
ASKER CERTIFIED SOLUTION
Avatar of tomaugerdotcom
tomaugerdotcom
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial