I have a very odd situation where my while loop 'sometimes' works and 'sometimes' not, but I can't find a common denominator. I am basically pulling an array from a stored procedure in PHP, something I have done numerous times before.
First off, I have this:
$rowpayments = mssql_fetch_assoc($rspayreview);
echo '<!-- DEBUG '; var_dump($rowpayments); echo ' -->';
This particular code DOES output the array in EVERY instance.
But when I attempt to while
through the results and output them, sometimes the loop doesn't get to the debug code.
while($payinfo = mssql_fetch_assoc($rspayreview)) {
echo '<!-- DEBUG CHECK 2 !-->';
//echo $payinfo['CardholderName'];
// other examples
}
There are time the debug check 2 doesnt even fire, but yet, sometimes it does and it shows me everything in the array.
For your reference, here is a var_dump example that outputs, but yet, doesn't show up in the while loop.
<!-- DEBUG array(7) {
["ResIDLink"]=>
int(165476)
["PayDate"]=>
string(26) "Mar 16 2015"
["CardholderName"]=>
string(13) "xxxx"
["Right4CCNum"]=>
string(4) "4984"
["ChargeAmount"]=>
float(300)
["Paid"]=>
int(1)
["CCType"]=>
string(4) "VISA"
}
Does anybody have any thoughts on this? It would be GREATLY appreciated.
EDIT, as an FYI, i HAVE attempted using a foreach
, however, it winds up giving me Illegal string offset
errors instead.
foreach( $rowpayments as $payinfo ) {