Well, that's not true. This is not C/C++ and an undefined value will print
nothing with no error.
Ilya Sterin
-----Original Message-----
From: Caraway, Michael
To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
Cc: DiGiovanni, Jim
Sent: 05/23/2001 6:39 AM
Subject: RE: Newbie Q. : fetchrow_array.
When a row of data is returned, some of the fields may be null. If so,
trying to print the field results in an error because you are accessing
an
undefined value. Check the values first (if defined) before using them.
Michael
-----Original Message-----
From: Krung Saengpole [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 23, 2001 3:47 AM
To: [EMAIL PROTECTED]
Subject: Newbie Q. : fetchrow_array.
Hello all,
I just start to learn dbi and have a problem with it. I use dbi to
connect
to Access database and fetch the data to array 'til end of file.
But it only showed 2 lines of data and error took place. No error code
or
message shown the reason why. My code is:
use DBI;
$dbh = DBI->connect('dbi:ODBC:myDSN', '','');
$sth = $dbh->prepare("Select * From TotalLevel");
$sth->execute();
while (@data = $sth->fetchrow_array) {
foreach (@data){
print "$_ \t";
}
print "\n";
}
$sth->finish;
$dbh->disconnect;
Any help would be appreciated. Thank you in advance.
Krung
Confidentiality Note: This e-mail, and any attachment to it, contains
privileged and confidential information intended only for the use of the
individual(s) or entity named on the e-mail. If the reader of this
e-mail
is not the intended recipient, or the employee or agent responsible for
delivering it to the intended recipient, you are hereby notified that
reading this e-mail is strictly prohibited. If you have received this
e-mail in error, please immediately return it to the sender and delete
it
from your system.
This e-mail and any attachment(s) are believed to be free from virus.
However it is the responsibility of the recipient to ensure that they
are
virus free. We do not accept any liability for any loss or damage
arising
in any way from the receipt, opening or use of this e-mail and any
attachment(s). Thank You.