Page 1 of 1

for statement question

Posted: Tue Feb 20, 2007 8:46 am
by speedy33417
I'm working on a schedule system, where employees sign in and check their appointments for the week. It contains the customer's address which has been working fine. Now I want to add an image link to pull a Google Map of the location.
On a day people have 3-5 appointments and the addresses are all in one <TD></TD> with a line break after each address.
I'd like to add the image that will be eventually a link (I'll add that later...) right after the address.
My problem is for some reason after the last address I get two images displayed. I guess my loop overruns my needs, I just don't understand why...

Code: Select all

echo "<td align=\"left\" class=\"table-BR\" bgcolor=\"CCF2FF\" nowrap>";
	for ($k = 0; $k <= $numJobsToday; $k++)
	{
		$kPlusOne = $k + 1;
		echo $custHouseNum[$k] . " " . $custStreet[$k];
		echo "&nbsp;<img src=\"images/getmap.jpg\" border=\"0\" width=\"10\" height=\"10\">";
		if ($kPlusOne < $numJobsToday)
		{
			echo "<br>";
		}
	}
echo "</td>";

Posted: Tue Feb 20, 2007 8:57 am
by feyd
<= should be < I suspect.

Posted: Tue Feb 20, 2007 9:00 am
by speedy33417
Argh!

I knew it was something small...

Thanks feyd.