close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

product detail not showing if downloads is empty

Thread began 4/23/2018 8:50 am by Jamie | Last modified 4/25/2018 11:15 am by Ray Borduin | 1163 views | 5 replies |

Jamie

product detail not showing if downloads is empty

Hi Ray

Have attached a page which shows the product detail.

I have also set it up so that a list of downloads shows if a user is logged in.

The problem is that if there are no downloads associated with the product (which there may not be) the product returning no product results.

The rs am using is

<?php
$Categories = new WA_MySQLi_RS("Categories",$DBConnection,0);
$Categories->setQuery("SELECT products.*, downloadproductjoin.*, download.* FROM products LEFT OUTER JOIN downloadproductjoin ON products.ProductID = downloadproductjoin.JoinProductID INNER JOIN download ON downloadproductjoin.JoinDownloadID = download.DownloadID WHERE products.ProdPermalink = ? AND products.ProductLive = 1 AND download.Live = 1");
$Categories->bindParam("s", "".$_GET["perm"] ."", "-1"); //WAQB_Param1
$Categories->execute();
?>



and theres more info in the PM

Sign in to reply to this post

Ray BorduinWebAssist

You are using an INNER JOIN instead of LEFT OUTER JOIN, the LEFT OUTER JOIN will always return the row even if there are no downloads.

Sign in to reply to this post
Did this help? Tips are appreciated...

Jamie

thats great thanks.

now the AND download.Live = 1 will only allow the product to show if the download is set to Live otherwise the product would show as no results.

how would I modify the rs to allow the product detail to show even if the download(s) were not live?

Sign in to reply to this post

Ray BorduinWebAssist

Put the check in the join instead of the where clause like:

SELECT products.*, downloadproductjoin.*, download.* FROM products LEFT OUTER JOIN downloadproductjoin ON products.ProductID = downloadproductjoin.JoinProductID LEFT OUTER JOIN download ON downloadproductjoin.JoinDownloadID = download.DownloadID AND download.Live = 1 WHERE products.ProdPermalink = ? AND products.ProductLive = 1

Sign in to reply to this post
Did this help? Tips are appreciated...

Jamie

brilliant thank you

last question on this, how would I now write an if statement to show content if the downloads side of the rs is empty ?

Sign in to reply to this post

Ray BorduinWebAssist

if (!$Categories->getColumnVal("DownloadID")) {

Sign in to reply to this post
Did this help? Tips are appreciated...

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...