Hi i have a problem with the output to show the images horizontal

in have the folowing code

$connn1 = mysql_connect(SQL_HOST, SQL_USER, SQL_PASS)
or die('Could not connect to MySQL database. ' . mysql_error());

$image=mysql_query("SELECT * FROM $weinachtfeier");
if (mysql_num_rows($image)<=0)

 echo "<br>Album does not exist or you are not logged in";
  $i = 0;
echo "<table cellspacing='3' cellpadding='4' cellspacing='9' border='1'><tr>";

//Loop through banners and display them

echo "<td>
<a href='".$row['location1']."' target='_blank'><img  src='".$row['location']."'></a><br>
<font size='2' face='arial'>
<b><a href='".$row['location1']."' target='_blank'>".$row['name']."</a></b><br>
Fotos  ".$row['albumdescription']."<br>


//Display images in rows of 3
if($i%3==0) {
echo "<tr></tr>";
//Increase counter by 1
//Check to see rather u need to move to new row
if(($i%3==0)) {
echo "<td> </td>";
echo "</tr>";
echo "</table>";

It display as follow:
in the first row i have 1 image and than 2 empty cells
The next rows are displayed proper, 3 images horizontal.

How cab it be displayed so that the first row begins with 3 images

Thanks in advice