Unless someone can point out why it wouldn't be better, but try using the PG module. It's an easier to use module for Postgres and it makes it's queries via the DBI. Agustin Rivera Webmaster, Pollstar.com http://www.pollstar.com ----- Original Message ----- From: "Johnson, Shaunn" <SJohnson6@bcbsm.com> To: <beginners@perl.org> Sent: Tuesday, April 02, 2002 9:47 AM Subject: perl / database question > Howdy: > > Running Postgres 7.1.3 on RedHat Linux 2.4.7 > and Perl 5.6.1. > > My goal is this: > > I am trying to put a perl / cgi script > together to display a list of tables > I pull back from Postgres. I would > like to put the table in a scrolling > menu form page. > > So far I have this: > > [snip code] > > #!/usr/bin/perl -w > > $debug=2; > > use Pg; > use CGI qw(:standard); > use CGI::Carp 'fatalsToBrowser'; > require "/var/www/hminclude.pl"; > > # Config stuff > # > # > > my $TITLE = 'Table Listing'; > > print header, > start_html(-title=>"Get Table List", -bgcolor=>'white'); > if (!param() ) { > start_form(); > } else { > print "$!"; > } > > print end_html; > > ### > > > sub start_form { > # connect to database > # > $conn=bcnOpen(); > $list_tbl=doquery('Table List', "select relname from pg_class where relname > not like 'pg\\_%' and relkind = 'r' order by 1"); > } > > while ( my($first, @full_list)=$list_tbl->fetchrow){ > print h1($TITLE), > hr; > print start_form, > print "<select name="tables" multiple size=3>"; > print "<option>"$first; > print "</select>"; > > print submit, > reset; > } > > [/snip code] > > > Few notes: > > Yes I am very new at this ... I was hoping I > could learn from some examples floating > around ... but I'm not sure where my results > should merge with the code (successfully). > > The 'while' statement: I want to say 'while > reading from this list of tables, create > a scrolling window and populate it with > the results from the sql query from above'. > > Are there any examples as to how to > do this? > > Thanks! > > -X >Thread Previous