The problem is to use the do ... while
structure to iterate over the registry. Considering the code below:
do {
<block>
} while (<condition>);
The code block set to <block>
will be executed before the <condition>
condition is checked. As in your problem, the condition is an assignment of the bank record to the variable $rowMsgLer
, in the first iteration of this loop, this variable will not exist, generating the presented error. To fix, just switch to the while
structure:
while (<condition>) {
<block>
}
So, the condition will be checked before the code block is executed and therefore, already in the first iteration of the loop, the variable will be properly $rowMsgLer
defined.