On Fri, Aug 24, 2001 at 10:07:59AM -0700, Katherine Porter wrote:
> For single values I usually use this DBI function and query:
> 
>   my $val =3D $dbh->selectrow_array("SELECT value FROM tab1 WHERE test=3D=
> 2");
> 
> However, what if I want to store a bunch of values into an array?
> 
>   my @vals =3D $dbh->?????("SELECT value FROM tab1 WHERE test > 10");
> 
> What's the syntax I'm missing above?  Any help appreciated!


Glance over this for a minute (stolen from an example in perl cookbook):

   my $sth = $dbh->prepare( qq{select * from invoice} );
   $sth-> execute;

   while( (my @row) = $sth->fetchrow_array ) {
      print join(qq{, }, map {defined $_ ? $_ : qq{(null)} } @row, qq{\n};
   }


-- 
 Any technology distinguishable from magic is insufficiently advanced.
     TopQuark Software & Serv.  Contract programmer, server bum.
     [EMAIL PROTECTED]        Give up Spammers; I use procmail.


---------------------------------------------------------------------
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