I am attempting to rewrite a piece of software, and the best I can determine is that it is attempting to grab the information from the table, and place it into a variable, which it will then use to perform a math function on. Unfortunately, there is no records in the DB for it to retrieve and the math calculation ends up being a divide by zero error:

Code fragment follows:

$sth = $dbh1->prepare("select emails,bugs,spyware,virus from counters where customer='$domainlogin'");
$sth->execute();
($demails,$dbugs,$dspyrware,$dvirus)=$sth->fetchrow_array();
$sth->finish();
$dbh1->disconnect;


If there is no record found, how can I test for this? Ideally I would like to set these records equal to zero and continue (or insert the record ....).

Ideas?

--
Albert E. Whale, CISA CISSP
Sr. Security, Network, Risk Assessment and Systems Consultant
-------------------------------------------------------------------
ABS Computer Technology, Inc. - www.ABS-CompTech.com
SPAM Zapper - No-JunkMail.com - Spam-Zapper.com - SPAM Stops Here.
President of the Pittsburgh InfraGard Alliance



Reply via email to