Hi there!

I'm having a problem when using fetchrow_array().

The area of the code where the problem is, you find below.

while (@row = $sth->fetchrow_array() ) {
$len = @row;
for ($i = 0; $i < $len; $i++) {
    if ($row[$i] ne ""){
 print $row[$i] . "\t";
    }
    else{
 print "undefined value in row\t";
    }
}

I've read and understand that the fetchrow_array() returns undef when a
value from the database is NULL. With the code above I can identify that
a value is NULL and print out the line "undefined value in row". So far
so good.

My problem is that I not only get the line "undefined value in row"
printed, but I also get this:
Use of uninitialized value at
/home/www/docs/cgi-bin/CCDB_P/maintrep2.cgi line 137.

I wonder how I can get rid of these lines and what causes this print. Is
there a good way to take care of such undefined values, that I've missed
reading about?

(I do have O'REILY "Programming the Perl DBI)

Thank you in advance
Michelle Gerfort

Reply via email to