in reply to (jeffa) Re: building Drop down menu - from a flat file
in thread building Drop down menu - from a flat file
Here is what i had:
you know i just say a mistake in my code, and when i tried to run it with just one column in the select it ran correctly! I wonder if DBI::CSV does allow mutilple columns to be listed with a DISTINCT#!/usr/local/bin/perl use DBI; my $dbh = DBI->connect( "DBI:CSV:f_dir=/export/home/temp;csv_eol=\n;csv_sep_char=!; +", {RaiseError=>1}, ); $dbh->{'csv_tables'}->{'datainfo'} = { 'file' => 'datainfo.data', # 'sep_char' => "!", 'quote_char' => undef, 'escape_char' => undef, 'col_names' => ["id", "class", "name", "instructor"] }; my ($query) = "select distinct id, class from datainfo "; my ($sth) = $dbh->prepare($query); $sth->execute(); while (my $row = $sth->fetchrow_hashref) { print ("ID =", $row->{'id'}, "\n\t CLASS = ", $row->{'class'} +, "\n"); } print "\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(jeffa) 3Re: building Drop down menu - from a flat file
by jeffa (Bishop) on Jul 25, 2002 at 05:34 UTC |