H
Huub
Hi,
I'm reading records from an MySQL database in order to print some of
them. The reading works well. Next is that I want to skip the empty
records. In CPAN I searched for "if" and found the "switch" statement:
$naam = "select naam from hvw where lidnr = $record";
$sth = $dbh->prepare($naam);
$sth->execute or die "SQL Error: $DBI::errstr\n";
@naam = $sth->fetchrow_array;
switch (@naam)
{
case " " { $record++; print "empty record: $record\n"; }
else ( read the rest of the fields from the database and print them }
}
Problem is that it seems to ignore the 'case " "', because everything is
printed. Where do I go wrong?
Thanks.
I'm reading records from an MySQL database in order to print some of
them. The reading works well. Next is that I want to skip the empty
records. In CPAN I searched for "if" and found the "switch" statement:
$naam = "select naam from hvw where lidnr = $record";
$sth = $dbh->prepare($naam);
$sth->execute or die "SQL Error: $DBI::errstr\n";
@naam = $sth->fetchrow_array;
switch (@naam)
{
case " " { $record++; print "empty record: $record\n"; }
else ( read the rest of the fields from the database and print them }
}
Problem is that it seems to ignore the 'case " "', because everything is
printed. Where do I go wrong?
Thanks.