If fetchrow() retrieves no data, the while loop terminates.

-----------------
Ron Reidy
Lead DBA
Array BioPharma, Inc.


-----Original Message-----
From: Mark Martin [mailto:[EMAIL PROTECTED]
Sent: Friday, January 28, 2005 5:58 AM
To: [email protected]
Subject: no rows selected


Hi,
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
              }                         

Regards,
Mark


This electronic message transmission is a PRIVATE communication which contains
information which may be confidential or privileged. The information is 
intended 
to be for the use of the individual or entity named above. If you are not the 
intended recipient, please be aware that any disclosure, copying, distribution 
or use of the contents of this information is prohibited. Please notify the
sender  of the delivery error by replying to this message, or notify us by
telephone (877-633-2436, ext. 0), and then delete it from your system.

Reply via email to