Howdy:
Still looking for examples / pointers ...
I am still butchering a page where I
connect to the database and get a list
of tables. That works -
My goal is to figure out how to select a
table and update the Description / input
comments for the table (and maybe - being
SUPER ambitious - add comments for each column).
[* Note: I have this BIG and UGLY query that gets
me the exact columns I want, but can't figure
out WHY I am unsuccessful at splitting them
into 4 different variables when I pass the array
variable - and in THAT, my quest goes back to
what I have outlined at the bottom ]
I think that part of the SQL I can manage ... but
how can I have a user select a table from the
list and pass that on to as another option?
For example, I have this:
[snip code]
#
# sub function of print_form
#
sub print_form {
#connect to database
my $dbh=DBI->connect('dbi:Pg:dbname=bcn', 'web')
or die "Can not connect: $!\n";
# get list of tables
my $sql= qq! select relname from pg_class
where relname not like 'pg\\_%'
and relkind = 'r' order by 1!;
my $sth=$dbh->prepare($sql) or die "Error =", DBI::errstr;
$sth->execute;
print <<EOF;
Table
<select name="Table">
EOF
while (my ($relname) = $sth->fetchrow) {
print <<END;
<option value="$relname">$relname</option>
END
}
print qq! </select>!;
}
[/snip code]
So ... there's my list ... but I'm not sure
about passing the selected argument to use
again and query against THAT ...
Fun, fun, fun 'til her daddy took the T-Bird away ...
Thanks!
-X