* Scott Phelps ([EMAIL PROTECTED]) [010315 10:11]:
> 
> Here's what doesn't work:
> 
> my $dbh=DBI->connect('dbi:ODBC:scottp', 'user', 'pass',
>               {RaiseError => 1,
>               AutoCommit => 1}
>               ) || errorhandler("Database connection error: $DBI::errstr");
> 
> $sth=$dbh->prepare("SELECT $content_field FROM $content_table WHERE page= ?
> AND type= ?");
> $sth->execute($content_page, $content_type);
> @content = $sth->fetchrow_array;
> $dbh->disconnect();
> 
> This of course returns an array (actually only one element) of the first row
> that satisfies my SQL statement.
> Is there a way to get the specific field of multiple rows that match my
> criteria into an array?

DBI comes with very good documentation, check it out:

    $sth->execute( $content_page, $content_type );
    while ( my $row = $sth->fetchrow_arrayref ) {
          ... do stuff with @{ $row }...
    }

Chris

-- 
Chris Winters ([EMAIL PROTECTED])
Building enterprise-capable snack solutions since 1988.

Reply via email to