Thanks - htmlspecialchars works a treat:
<?php
$db = "gallery";
$link = mysql_connect( "user", "pass" );
if ( !$link ) die( "Couldn't connect to MySQL".mysql_error() );
mysql_select_db( $db, $link ) or die( "Couldn't open $db: ".mysql_error() );
$sql = "SELECT * FROM galleryTable WHERE tour = '$page' ORDER BY id DESC";
$result = mysql_query( $sql, $link );
while ( $newArray = mysql_fetch_array($result) )
{
$id = $newArray['id'];
$status = $newArray['status'];
$name = $newArray['name'];
$materials = $newArray['materials'];
$size = $newArray['size'];
$size = htmlspecialchars($size);
$fupload = $newArray['fupload'];
$tupload = $newArray['tupload'];
print "
<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td valign=top width=\"40%\">
<a href=\"display.php?fupload=$fupload&name=$name&materials=$materials&status=$status&size=$size\"><img src=\"/images/archive/$tupload\"></a>
</td>
<td valign=bottom width=\"60%\"><p class=smalltext>$name<br>$materials<br>$size<br>$status</p></td>
</tr>
</table><hr noshade color=#000000>
";
}
mysql_close( $link );
?>
and i used stripslashes to escape the slashes that exist in the page that the link called:
<?php $size = stripslashes($size); print " $size "; ?>