I was trying to make data from an array either go left (DR) or right (CR) when meeting certain conditions. My problem is with display, on the logic and the display.
// While Looping - Its fine here!
while ($newArray_pin = mysql_fetch_array($result_pin)) {
// Here is fine also
$amount = $newArray_pin['net_reduction'];
$dr_cr_action = $newArray_pin['dr_cr_code_inc'];
//I don't know what am doing wrong here, problem starts here
if ($dr_cr_action === 'DR') {
$show_dr_amount = $amount;
} else {
$show_cr_amount = $amount;
}
$display_block_pin .= "<tr>
<td><div class=\"text-center\">$joint_account_numbers</div></td>
<td><div class=\"text-left\">$account_title</div></td>
<td><div class=\"text-right\">$show_dr_amount</div></td>
<td><div class=\"text-right\">$show_cr_amount</div></td>
</tr>";
}
$display_block_pin .= "</table>";
print $display_block_pin;
// On table display, records does not go left and right as I expected with the variable $show_dr_amount and $show_cr_amount