Jump to content

Problem inserting payment info from table into dynamically created table


Recommended Posts

What I'm doing is dynamically creating a table that automatically calculates the due date (based off of original, single DB entry) and what I need to do NOW is interrupt the loop at a certain point to inject a payment from another table. Here's the code that I have:

while($startdate <= $today)
{
	if ($startdate <= $pmt_date) {
		echo '<tr><td style="border-bottom-color:#3105b0; border-bottom-style:dashed; border-bottom-width:thin;"><center>'. date("m.d.Y", $startdate) . '</center></td>';
		echo '<td style="border-bottom-color:#3105b0; border-bottom-style:dashed; border-bottom-width:thin;"><center>'. "$" . $english_format_number = number_format($row["supportamount"], 2, '.',',') . '</center></td>';
		echo '<td style="border-bottom-color:#3105b0; border-bottom-style:dashed; border-bottom-width:thin;"><center>$0.00</center></td>';echo '<td style="border-bottom-color:#3105b0; border-bottom-style:dashed; border-bottom-width:thin;"><center>'. $intacc . '</center></td>';
echo '<td style="border-bottom-color:#3105b0; border-bottom-style:dashed; border-bottom-width:thin;"><center>'. $appint . '</center></td>';
echo '<td style="border-bottom-color:#3105b0; border-bottom-style:dashed; border-bottom-width:thin;"><center>'. $appprinc . '</center></td>';
echo '<td style="border-bottom-color:#3105b0; border-bottom-style:dashed; border-bottom-width:thin;"><center>'. $bal . '</center></td></td>';
  $startdate = strtotime('+1 month', $startdate);
	} else {
		echo '<tr><td style="border-bottom-color:#3105b0; border-bottom-style:dashed; border-bottom-width:thin;"><center>'. date("m.d.Y", $pmt_date) . '</center></td>';
		echo '<td style="border-bottom-color:#3105b0; border-bottom-style:dashed; border-bottom-width:thin;"><center>$0.00</center></td>';
		echo '<td style="border-bottom-color:#3105b0; border-bottom-style:dashed; border-bottom-width:thin;"><center>'. "$".$english_format_number = number_format($row2["pmt_amt"], 2, '.',',') . '</center></td>';	echo '<td style="border-bottom-color:#3105b0; border-bottom-style:dashed; border-bottom-width:thin;"><center>'. $intacc . '</center></td>';
		echo '<td style="border-bottom-color:#3105b0; border-bottom-style:dashed; border-bottom-width:thin;"><center>'. $appint . '</center></td>';
		echo '<td style="border-bottom-color:#3105b0; border-bottom-style:dashed; border-bottom-width:thin;"><center>'. $appprinc . '</center></td>';
		echo '<td style="border-bottom-color:#3105b0; border-bottom-style:dashed; border-bottom-width:thin;"><center>'. $bal . '</center></td></td>';
		}
}
echo '</table>';

There's only one instance of what is needed being injected working, then it repeated continuously.  

What I need to do it have it only apply ONCE during that loop...

 

possibly a foreach() statement?  If so, how would I do that and have the $pmt_date array automatically generated and how would the table generate?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.