----- Original Message -----
From: Mark Martin <[EMAIL PROTECTED]>
Date: Friday, January 28, 2005 10:22 am
Subject: no rows selected
> Hi,
Hello,
> I'm running a test to see whether certain criteria in a SELECT
> statement
> return record or not. If I get a "no rows selected" from SQL then
> I want to
> perform a specific action . But I don't how perform the test for
> "no rows
> selected " ?
>
>
> $sql = qq{SELECT RECORD FROM TABLE WHERE FIELD = ? } ;
> $sth = $dbh->prepare($sql) ;
> $sth->execute($variable) ;
> while (@fetch = $sth4->fetchrow)
> {
> if ("no rows selected " .................?????? ) ### Don't know
> how to
> test this
> {
> #perform my tasks
# Perhaps this will work
unless( scalar @fetch ){
#do you work here
}
> }
> Regards,Mark
HTH,
Mark
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>