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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.