I'm using PHP to piece together photos on my website. I have the pieces in the correct order, but there is white space between each photo. At the moment, the only Css I have is placing the black border around the specified outer edges of the photo - I added this after the white space problem, so I can't think that it affects it.

Could anyone suggest how to correct this issue?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Equine Focus</title>
<link rel="stylesheet" type="text/css" href="/style/20090330.css"/>
</head>

<body>

<?php

	// 	Connects to your Database  

		mysql_connect("*****", "*****", "*****") or die(mysql_error());  
		mysql_select_db("*****") 
		or die ("Unable to connect to MySQL");


	// mysql

		$data = mysql_query("SELECT * FROM `photos` WHERE date = '2009-03-21' AND ref ='001'") or die 
		("No data available, please contact the site admin describing where you found this error message.");  
		?>

<table align='center' border='0' padding='0' spacing='0'>

<?php
		while($info = mysql_fetch_array($data)) {  
		
	// images

		$image1='/photos/'.$info['date'].'/'.$info['ref'].$info['piece1'];
		$image2='/photos/'.$info['date'].'/'.$info['ref'].$info['piece2'];
		$image3='/photos/'.$info['date'].'/'.$info['ref'].$info['piece3'];
		$image4='/photos/'.$info['date'].'/'.$info['ref'].$info['piece4'];
		$image5='/photos/'.$info['date'].'/'.$info['ref'].$info['piece5'];
		$image6='/photos/'.$info['date'].'/'.$info['ref'].$info['piece6'];
		$image7='/photos/'.$info['date'].'/'.$info['ref'].$info['piece7'];
		$image8='/photos/'.$info['date'].'/'.$info['ref'].$info['piece8'];
		$image9='/photos/'.$info['date'].'/'.$info['ref'].$info['piece9'];
		$image10='/photos/'.$info['date'].'/'.$info['ref'].$info['piece10'];
		$image11='/photos/'.$info['date'].'/'.$info['ref'].$info['piece11'];
		$image12='/photos/'.$info['date'].'/'.$info['ref'].$info['piece12'];
		$thumb='/photos/'.$info['date'].'/thumbs/'.$info['ref'];

	// ref

		$ref = $info['date'].'-'.$info['ref'];

	// write-up
		$text=$info['horse'].' ridden by '.$info['rider'];
		
?>

    <tr>
        <td><div id='image1'><img src="<?php echo $image1; ?>"</a></div></td>
        <td><div id='image2'><img src="<?php echo $image2; ?>"</a></div></td>
        <td><div id='image3'><img src="<?php echo $image3; ?>"</a></div></td>
        <td><div id='image4'><img src="<?php echo $image4; ?>"</a></div></td>
    </tr>


    <tr>
        <td><div id='image5'><img src="<?php echo $image5; ?>"</a></div></td>
        <td><div id='image6'><img src="<?php echo $image6; ?>"</a></div></td>
        <td><div id='image7'><img src="<?php echo $image7; ?>"</a></div></td>
        <td><div id='image8'><img src="<?php echo $image8; ?>"</a></div></td>
    </tr>


    <tr>
        <td><div id='image9'><img src="<?php echo $image9; ?>"</a></div></td>
        <td><div id='image10'><img src="<?php echo $image10; ?>"</a></div></td>
        <td><div id='image11'><img src="<?php echo $image11; ?>"</a></div></td>
        <td><div id='image12'><img src="<?php echo $image12; ?>"</a></div></td>
    </tr>

		<tr><td><span class="refno">Photo Reference: <?php echo $ref; ?></span></td></tr>
		<tr><td><span class="infotext"><?php echo $text; ?></td></tr></span>

</table>

<?php
}  
?>
</table></body></html>

Problem page: http://www.equinefocus.co.uk/photos/2009-03-21/001.php

Umm... not sure. You can try to set "cellspacing=0" and "cellpadding=0" in each <td>. And you have an "</a>" in each field without any opening tag.

This article has been dead for over six months. Start a new discussion instead.