PHP Classes

Variable Assignment fails during fetch

Recommend this page to a friend!

      Top level forums  >  PHP Specialists  >  General  >  Variable Assignment fails during fetch  
Subject:Variable Assignment fails during fetch
Summary:Code which was working suddenly fails - why?
Messages:8
Author:Joey Riso
Date:2016-04-15 14:06:43
Update:2016-04-15 17:55:18
 

  1. Variable Assignment fails during fetch   Reply   Report abuse  
Picture of Joey Riso Joey Riso - 2016-04-15 17:55:18
I had a piece of code which was using a Prepared Statement to return a result set of a few hundred rows ($queryGetFinancials).

One of the columns in the returned set was assigned to the variable $status.

This block of code followed:

while ($queryGetFinancials->fetch()) {
$status = strtolower($status);
switch ($status) {
case 'bid':
$n = $b++;
break;
case 'in-work':
$n = $i++;
break;
case 'active':
$n = $a++;
break;
}
...do more processing

The code worked fine for many months, then, yesterday, for no reason that I can understand, the section suddenly failed, with the $status variable being assigned to the value of the first row returned, and never updating.

My questions are:
1) Is my initial code a misuse of the reassignment
$status = strtolower($status;

2) What could cause the code to change its operation?

Thanks --



There are 7 replies in this thread, which are not being displayed.
Browsing this forum thread replies is available only to premium subscribers.


Go to the premium subscriptions page to learn how to become a premium subscriber and have full access to this forum.