Database Problem
| From: | Scott Carr | Date: | Thu, 19 Jun 2003 00:59:37 +0000 |
| Subject: | Database Problem | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-6110@lists.php.net to get a copy of this message | ||
I have a problem with the following:
$strSQL = "SELECT * FROM billusage";
$strSQL .= " WHERE scenario_billed=0";
$billing = $GLOBALS['db']->query($strSQL);
if (!DB::isError($billing)) {
// Iterate over each record
// Process Phone calls for billing
while ($billing->fetchInto($row, DB_FETCHMODE_ASSOC)) {
$billed = 0;
echo "{$row['BillUsage_ID']}<br />";
if ($row[5] == 0) {
$billed = 1;
} else {
$billed = billactivation($row['BillUsage_ID']);
}
$strRET .= "Billed {$row['Company_ID']}: ";
$strRET .= " {$row['Activation_Name']}<br />\n";
$strSQL = "UPDATE billusage ";
$strSQL .= "SET billed=$billed ";
$strSQL .= "WHERE BillUsage_ID={$row['BillUsage_ID']}";
$GLOBALS['db']->query($strSQL);
}
} else {
//TODO Return Error in SELECT
$strRET .= "An Error Occured processing Billing.";
$strRET .= "<br />" . $billing->getMessage();
}
Basically what is happening is that I iterate over the rows correctly, but
fetchInto doesn't stop at the end of the Dataset. It keeps going until a
timeout occurs.
I need to update each row as I process it, so it doesn't get billed again.
What is causing this? Is this a bug?
Thanks.
Scott