Hi guys
Thanks for your help with this.
So far I've managed to get the page to display all the related records, but the script displays a row for each prop_id from prop_details that has a related img_thumb.
Any idea how I can get this to display just one row for each record for prop_id in prop_details and then display all related img_thumbs in one cell in the table (the one that currently shows <td><img src="../images/tns/<?php echo $row_Recordset1['img_thumb']; ?>" width="50" height="50" alt="<?php echo $row_Recordset1['short_desc']; ?>" /></td>)
Thanks again
Phil
<?php require_once('../Connections/prop.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($database_prop, $prop);
$query_Recordset1 = "SELECT prop_details.prop_id, prop_details.prop_ref, prop_details.short_desc, prop_images.img_thumb, prop_images.prop_id FROM prop_details LEFT JOIN prop_images ON prop_details.prop_id=prop_images.prop_id";
$Recordset1 = mysql_query($query_Recordset1, $prop) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?><!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<table width="80%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td>Prop ID</td>
<td>Office Ref</td>
<td>Short Desc</td>
<td>Thumbs</td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_Recordset1['prop_id']; ?></td>
<td><?php echo $row_Recordset1['prop_ref']; ?></td>
<td><?php echo $row_Recordset1['short_desc']; ?></td>
<td><img src="../images/tns/<?php echo $row_Recordset1['img_thumb']; ?>" width="50" height="50" alt="<?php echo $row_Recordset1['short_desc']; ?>" /></td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>