Web Tools

Started by Ronald L. Chichesterabout 27 years ago3 messagesgeneral
Jump to latest
#1Ronald L. Chichester
complaw@hal-pc.org

Hi:

I want to use PostgreSQL as a database engine for a web-based intranet
(using Apache on Linux). Is there a repository of CGI examples that I
could use, or are there some software tools that could take out some of
the time and grunt work?

Thanks in advance,

Ron Chichester

#2jutta staudach
jutta.staudach@jez.at
In reply to: Ronald L. Chichester (#1)
Re: Web Tools

I found no examples, but a very good description in the Pg.pm file
here is a example for a local database:
#!/usr/bin/perl
print "Content-type: text/html", "\r\n\r\n";
print "<HTML>", "\n";
print "<HEAD><TITLE></TITLE></HEAD>","\n";
print "<body bgcolor=#FFFFFF link='#0000FF'vlink='#800080'>","\n";
print "<BODY>", "\n";
require Pg;
$conn = Pg::connectdb("dbname=postgres");

Pg::doQuery($conn, "select * from probe", \@ary);

for $i ( 0 .. $#ary ) {
for $j ( 0 .. $#{$ary[$i]} ) {
print "$ary[$i][$j]\t";
}
print "\n";
}
print "</BODY></HTML>", "\n";
exit(0);
Ciao Jutta
Ronald L. Chichester schrieb:

Show quoted text

Hi:

I want to use PostgreSQL as a database engine for a web-based intranet
(using Apache on Linux). Is there a repository of CGI examples that I
could use, or are there some software tools that could take out some of
the time and grunt work?

Thanks in advance,

Ron Chichester

#3J J
linux2000@hotmail.com
In reply to: jutta staudach (#2)
Re: Web Tools

Ronald L. Chichester wrote:

Hi:

I want to use PostgreSQL as a database engine for a web-based intranet
(using Apache on Linux). Is there a repository of CGI examples that I
could use, or are there some software tools that could take out some of
the time and grunt work?

Thanks in advance,

Ron Chichester

This uses the built in "print a HTML table row" function:

#!/usr/bin/perl -w

use Pg;
use CGI;

$wp = new CGI;

$custname = uc $wp->param('custname');
print $wp->header;
print $wp->start_html(-author=>"jj");

$conn = Pg::connectdb("dbname = john");
if ($conn->status != PGRES_CONNECTION_OK) {
die("Can't connect");
}

$res = $conn->exec("select * from workorder where name like
'%$custname%'");
#fout, header, align, standard, html3, expanded, pager, fieldSep,
tableOpt, caption, ...
$res->print (STDOUT, "", "", 0, 1, 0, 0, "|", "border=1", "Customers");

print $wp->end_html;