close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Display data from related tables in results

Thread began 4/30/2009 11:48 am by phil.evans372967 | Last modified 8/27/2010 12:04 pm by phil.evans372967 | 8979 views | 16 replies

phil.evans372967

Display data from related tables in results

Hi all,

I'm trying to display data in my main results pages from two related tables

prop_details
prop_images

I'd like display all thumbnails from prop_images that are related to prop_details, the relationship being prop_id

I've create a new recordset



<?php
$maxRows_WADAprop_details = 5;
$pageNum_WADAprop_details = 0;
if (isset($_GET['pageNum_WADAprop_details'])) {
$pageNum_WADAprop_details = $_GET['pageNum_WADAprop_details'];
}
$startRow_WADAprop_details = $pageNum_WADAprop_details * $maxRows_WADAprop_details;

mysql_select_db($database_prop, $prop);
$query_WADAprop_details = "SELECT prop_ref, prop_id, add_date, prop_type, short_desc, town, price, status, featured FROM prop_details";
$query_limit_WADAprop_details = sprintf("%s LIMIT %d, %d", $query_WADAprop_details, $startRow_WADAprop_details, $maxRows_WADAprop_details);
$WADAprop_details = mysql_query($query_limit_WADAprop_details, $prop) or die(mysql_error());
$row_WADAprop_details = mysql_fetch_assoc($WADAprop_details);

if (isset($_GET['totalRows_WADAprop_details'])) {
$totalRows_WADAprop_details = $_GET['totalRows_WADAprop_details'];
} else {
$all_WADAprop_details = mysql_query($query_WADAprop_details);
$totalRows_WADAprop_details = mysql_num_rows($all_WADAprop_details);
}
$totalPages_WADAprop_details = ceil($totalRows_WADAprop_details/$maxRows_WADAprop_details)-1;

mysql_select_db($database_prop, $prop);
$query_SelectThumb = "SELECT prop_images.img_thumb, prop_images.prop_id, prop_details.prop_id FROM prop_images, prop_details WHERE prop_images.prop_id = prop_details.prop_id";
$SelectThumb = mysql_query($query_SelectThumb, $prop) or die(mysql_error());
$row_SelectThumb = mysql_fetch_assoc($SelectThumb);
$totalRows_SelectThumb = mysql_num_rows($SelectThumb);
?>

which makes the match (I think)

but I can't get the image file names to display in my table row in the main repeat region

<?php do { ?>
<tr class="<?php echo $WARRT_AltClass1->getClass(true); ?>">
<td class="WADAResultsTableCell"><?php echo($row_WADAprop_details['prop_ref']); ?></td>
<td class="WADAResultsTableCell"><?php echo($row_WADAprop_details['prop_id']); ?></td>
<td class="WADAResultsTableCell"><?php echo($row_WADAprop_details['add_date']); ?></td>
<td class="WADAResultsTableCell">Display all image in series related to the record here<?php echo $row_SelectThumb['img_thumb']; ?></td>
<td class="WADAResultsTableCell"><?php echo($row_WADAprop_details['prop_type']); ?></td>
<td class="WADAResultsTableCell"><?php echo($row_WADAprop_details['short_desc']); ?></td>
<td class="WADAResultsTableCell"><?php echo($row_WADAprop_details['town']); ?></td>
<td class="WADAResultsTableCell"><?php echo($row_WADAprop_details['price']); ?></td>
<td class="WADAResultsTableCell"><?php echo($row_WADAprop_details['status']); ?></td>
<td class="WADAResultsTableCell"><?php echo($row_WADAprop_details['featured']); ?></td>
</tr>
<?php } while ($row_WADAprop_details = mysql_fetch_assoc($WADAprop_details)); ?>

Can anyone help?

Thanks

Phil

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...