Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl (http://www.velocityreviews.com/forums/f17-perl.html)
-   -   Re: how to select rows with $dbh->do($sql) (http://www.velocityreviews.com/forums/t24159-re-how-to-select-rows-with-dbh-do-sql.html)

Scott Lander 07-11-2003 01:26 PM

Re: how to select rows with $dbh->do($sql)
 
Can't use "do" for a select, for this very reason - it does not retrun the
data.

<whonose@nowhere.com> wrote in message
news:2t8fgv4in16fo6jrrgt9enmrdnt4a1e28d@4ax.com...
> I've read that doing do($sql) is faster than doing a prepare and
> excute, except I can't find how to select the rows in a table.
>
> Something like the following
>
> $sql = "select fieldA, fieldB from table"
> my $row = $dbh->do($sql) or die "select failed";
>
> I can't see how to get the while to loop through the data the select
> would return
>
> while ( $row = fetchrow_hashref )
> { fieldAreturned = $row->(fieldA);
> fieldBretruned = $row->(fieldB)
> }
>
> thanks





All times are GMT. The time now is 04:07 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.