H
Huub
Hi,
I have a script that somehow doesn't process the "if" statement.
$plaats = "select plaats from hvw where lidnr = $record";
$sth = $dbh->prepare($plaats);
$sth->execute or die "SQL Error: $DBI::errstr\n";
@plaats = $sth->fetchrow_array;
$plaats[0] = @plaats;
if ($plaats[0] == 'Londen')
{
$voorletters = "select voorletters from hvw where lidnr = $record";
$sth = $dbh->prepare($voorletters);
$sth->execute or die "SQL Error: $DBI::errstr\n";
@voorletters = $sth->fetchrow_array;
This script stays busy without result.
$plaats = "select plaats from hvw where lidnr = $record";
$sth = $dbh->prepare($plaats);
$sth->execute or die "SQL Error: $DBI::errstr\n";
@plaats = $sth->fetchrow_array;
$plaats[0] = @plaats;
unless ($plaats[0] == 'Londen')
{
$voorletters = "select voorletters from hvw where lidnr = $record";
$sth = $dbh->prepare($voorletters);
$sth->execute or die "SQL Error: $DBI::errstr\n";
@voorletters = $sth->fetchrow_array;
Though this does give results, it shows everything, including when it's
Londen.
I've been searching through CPAN and have tried with and without
brackets and/or quotes, @ instead of $, with and without [0], but I
can't get it right. Where am I going wrong?
Thanks for helping out.
Huub
I have a script that somehow doesn't process the "if" statement.
$plaats = "select plaats from hvw where lidnr = $record";
$sth = $dbh->prepare($plaats);
$sth->execute or die "SQL Error: $DBI::errstr\n";
@plaats = $sth->fetchrow_array;
$plaats[0] = @plaats;
if ($plaats[0] == 'Londen')
{
$voorletters = "select voorletters from hvw where lidnr = $record";
$sth = $dbh->prepare($voorletters);
$sth->execute or die "SQL Error: $DBI::errstr\n";
@voorletters = $sth->fetchrow_array;
This script stays busy without result.
$plaats = "select plaats from hvw where lidnr = $record";
$sth = $dbh->prepare($plaats);
$sth->execute or die "SQL Error: $DBI::errstr\n";
@plaats = $sth->fetchrow_array;
$plaats[0] = @plaats;
unless ($plaats[0] == 'Londen')
{
$voorletters = "select voorletters from hvw where lidnr = $record";
$sth = $dbh->prepare($voorletters);
$sth->execute or die "SQL Error: $DBI::errstr\n";
@voorletters = $sth->fetchrow_array;
Though this does give results, it shows everything, including when it's
Londen.
I've been searching through CPAN and have tried with and without
brackets and/or quotes, @ instead of $, with and without [0], but I
can't get it right. Where am I going wrong?
Thanks for helping out.
Huub