php error Parse error: syntax error, unexpected $end

Please help The following code gives me the error in the subject of this post:

			<table cellpadding="0" cellspacing="0" style="width: 716px; height: 1px">
				<!-- MSTableType="layout" -->
				<tr>
					<?php
						$any_rows =  mysql_query("SELECT * FROM $database");
						$num_rows = mysql_num_rows($any_rows);	
						if ($num_rows != 0)
						{
							$max_row = get_max_id($database);
							for($pointer = 0; $pointer <= $max_row; $pointer++)
  							{
  								$result = mysql_query("SELECT fileName FROM {$database} WHERE id = {$pointer}");
								confirm_query($result);
								$row = mysql_fetch_array($result);			
								while ($row = mysql_fetch_array($result))
								{				
									if ($row['0']!="")
									{
										?><td>
										<img alt="Next Posting" height="131" width="121" src="
										<?php echo "..household/images/{$row['0']}";?>
										">
										</td>
									}
								}
							}	
						}
				</tr>
			</table>
Sponsor our Newsletter | Privacy Policy | Terms of Service