Try changing
$i<$col
to
$i<@row
Where is $col populated? What is in $select?
-----Original Message-----
From: Kevin Sheen [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 01, 2001 3:15 PM
To: [EMAIL PROTECTED]
Subject: fetchrow_array() help
if ($select) {
$dbh = DBI->connect( 'xxx', 'xxx', 'xxx' );
$sth = $dbh->prepare ( $select )
or die "Can't prepare SQL statement: $DBI::errstr\n";
$sth->execute();
print "<TABLE border=1>\n";
while ( @row = $sth->fetchrow_array() ) {
print "<TR ALIGN=Left>\n";
for ($i=0; $i<$col; $i++) {
print "<TD>$row[i]</TD>";
}
print "</TR>\n";
}
print "</TABLE>\n";
$dbh->disconnect();
}
The above code is generating the following:
acer, ken acer, ken acer, ken
allen, william allen, william allen, william
anonymous anonymous anonymous
atkinson, jennifer atkinson, jennifer atkinson, jennifer
auer customer auer customer auer customer
It would appear that printing out $row[i] isn't working or I'm doing it wrong
(probably, the latter). Does anyone have any suggestions?
thanks,
Kevin