hi. hope you be fine. I am working like you..:) test it... my $sql_main = "SELECT name,famil FROM $main_table where famil='$USERNAME' ORDER BY name";
$sth = $dbh->prepare($sql_main) and print "<B>View Users </B><BR>\n" or die print "<B>Cannot prepare sql statement: </B> $sql_main <BR><BR>$DBI:: errstr"; my $rc = $sth->execute or die print "<B>Cannot execute sql statement: </B> $sql_main <BR> $DBI::errstr"; print "<HR><Center>"; print "<TABLE BORDER=5 CELLPADDING=5>\n"; print "<TR>\n"; # Field name headings (one would only print one set of headings) @name = @{$sth->{'NAME'}}; foreach my $head (@name) { print "<TD><B>$head</B></TD>\n"; } print "<TD ALIGN=\"CENTER\"><B>Account</B>\n"; while(@row = $sth->fetchrow_array) { print "<TR>\n"; foreach my $field (@row) { print "<TD ALIGN=\"CENTER\"><B>$field</B></TD>\n"; } print "</TR>\n"; } print "</TABLE></CENTER>\n"; print "\n <B>Number of rows returned:</B> ", $sth->rows, "<BR>\n"; _____________________________ Have a nice day Sincerely yours Nafiseh Saberi The amount of beauty required to launch one ship. < I appreciate your sugesstions > ____________________________ ----- Original Message ----- From: "Gerry Jones" <[EMAIL PROTECTED]> To: "CGI Beginners" <[EMAIL PROTECTED]> Sent: Monday, January 14, 2002 19:51 PM Subject: Tables in CGI > I've been tormented by a very small problem. I'm trying to display the > results of a database query using CGI. What I've done is create subroutines > to return the names of the table columns and another to return the data, both > of which are stored in seperate arrays. So I have my data, but the table just > doesn't come out right. The problem is the arrays can be of different sizes, > and I'm finding it really difficult to code a dynamic table using CGI. I > could do it in pure HTML easily, but that's not the point: I'm trying to keep > my code consistent. I've searched the 'net but the solutions I found didn't > work. > > Thanks in advance, > > Gerry. > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]