for statement question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
speedy33417
Forum Contributor
Posts: 128
Joined: Sun Jul 23, 2006 1:14 pm

for statement question

Post 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>";
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

<= should be < I suspect.
User avatar
speedy33417
Forum Contributor
Posts: 128
Joined: Sun Jul 23, 2006 1:14 pm

Post by speedy33417 »

Argh!

I knew it was something small...

Thanks feyd.
Post Reply