Connecting Tech Pros Worldwide Help | Site Map

problem printing out content of database table

Newbie
 
Join Date: Nov 2006
Posts: 1
#1: Nov 16 '06
Although I have written some perl ,I have obviously missed something. I have created a database for my local tennis club, which can be updated etc etc. I thought it would be a good idea to for members to view details on line, for contact purposes (more likely to get a team out). So I wrote the code (below). The first record of the database is nicely viewed in the table.However, all other records appear as just one long line of data, outside the table. I am missing something here, and having spent all week trying to correct but to no avail getting totally frustrated. The data is in the hash %name, I need to split this up somehow. Any ideas please.

#!C:/perl/bin/perl

require "formparser.lib";
&parseform;

%members=("existing","membership");

use Win32::ODBC;

$DSN = "Tennis";

my$Database = Win32::ODBC->new($DSN);
if (! $Database){
print "Failed to connect $DSN\n";
Win32::ODBC::DumpError();
die;
}

$SQL = "Select name,membership_cat,standard,team From $members{existing}";


if ($Database->Sql($SQL)){
print "Error getting existing info for $members{existing}\n";
$Database->DumpError();
}



print "Content-type: text/html\n\n";
print "<HTML><HEAD>\n<TITLE>";
print "Here are all current members";
print "</TITLE>\n</HEAD><BODY>\n";
print "Here are all current members";
print "<table border=1 cellpadding=5>";

print "<tr><th align=left>Name <th align=left>Membership Category <th align=left>Standard <th align left>Team </tr>\n";

while($Database->FetchRow()){
%name = $Database->DataHash;



print "<tr><td>$name{name}<td>$name{membership_cat}<td>$ name{standard}<td>$name{team}</tr>\n";

print "</table>";
print "</BODY></HTML>";
}
Reply