while(sth->fetch()){
print ("$mdate,$location,$agen,$min");
}
what i want to do is display this in a neat tabular way in HTML
so that the person seeing the site can see it in the form of a table
help please
print ("Content-type: text/html\n\n");
print "<html>\n";
print "<head>\n";
print "<title>your title</title>\n";
print "</head>\n";
print "<body>\n";
print "<table><n";
print "<tr>\n";
while(sth->fetch()){
print "<td>$mdate</td>\n";
print "<td>$location</td>\n";
print "<td>$agen</td>\n";
print "<td>$min</td>\n";
}
print "</tr>\n";
print "</table>\n";
print "</body>\n";
print "</html>\n";
I have pasted my code below
everyting seems simple enough not sure what the problem is
everything is working except the bit where i try to present it in tables
#!/usr/local/bin/perl -w
print "Content-type: text/html\n\n";
use CGI;
use File::Copy;
use CGI qw(:standard);
use DBI;
$query=new CGI;
$agendadir="/raid5/newhome/njicc/";
$month=param("Month");
$day=param("Day");
$year=param("Year");
$file1 = param('file');
$filedes=param('filedes');
$filetype=param('filetype');
print ("$filetype");
print ("$file1");
$file1 =~ s/.*[\/\\](.*)/$1/;
print ("$file1");
$newfilename1="$month"."$year"."$day"."$filedes";
$newfilename="$newfilename1.$filetype";
print("$newfilename");
$DATA= $query->upload("file");
my $success = open OUTPUTFILE,">$agendadir/$filedes/$newfilename";
unless($success){
print "Cannot open file!";
}
binmode OUTPUTFILE;
while (<$DATA>)
{
print OUTPUTFILE;
}
close OUTPUTFILE;
$dbname = '******';
$user = '*********';
$passwd = '*********';
$dbh = DBI->connect($dbname, $user, $passwd, 'Oracle');
if($dbh)
{
print ("Connection for the database successful");
}
else
{
die("Connection to the database unsuccessful");
}
my $sth=$dbh->prepare('SELECT * from meeting')or die "Couldn't prepare statement: " . $dbh->errstr;
if (!defined $sth ) {
die "Cannot prepare statement: $DBI::errstr\n";
}
$sth->execute()or die "Couldn't execute statement: " . $sth->errstr;
my ($mdate,$location,$agen,$agenext,$min,$minext);
$sth->bind_columns(\$mdate,\$location,\$agen,\$agenext,\$min,\$minext);
print ("i have executed my commands");
print ("Content-type: text/html\n\n");
print "<html>\n";
print "<head>\n";
print "<title>your title</title>\n";
print "</head>\n";
print "<body>\n";
print "<table><n";
print "<tr>\n";
while(sth->fetch())
{
print "<td>$mdate</td>\n";
print "<td>$location</td>\n";
print "<td>$agen</td>\n";
print"<td>$agenext<\td>\n";
print "<td>$min</td>\n";
print "<td>$minext</td>\n";
print "$mdate,$location,$agen,$agenext,$min,$minext";
}
print "</tr>\n";
print "</table>\n";
print "</body>\n";
print "</html>\n";
#print "$mdate,$location,$agen,$agenext,$min,$minext";
if ($sth->rows == 0) {
print "No names matched.\n\n";
}
$sth->finish;
$dbh->disconnect();
If you want a nice HTML output, your first print statements (after the print Content-type on line#2) should be:
print "<html>\n";
print "<head>\n";
print "<title>your title</title>\n";
print "</head>\n";
print "<body>\n";
at the end:
print "</body>\n";
print "</html>\n";
Maybe it's a good idea to create a HTML file that displays all parameters you need (in table cells). When you're satisfied about the layout, you can integrate the HTML code in your script.
sorry, but I did not review the entire code, I've other plans today ;-)
For example, if you have a recordset of 150 rows, you can display 30 at a time and display Prev. and Next buttons to show the previous or next 30 records. Just Dataseek->30 or 60 or whatever and print those 30 records.