close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

SQL error trying to access recordset

Thread began 1/05/2010 8:21 am by robert329616 | Last modified 2/09/2010 6:34 pm by Jason Byrnes | 9872 views | 10 replies |

robert329616

SQL error trying to access recordset

Hello,

I am having an issue trying to access the recordset on the Products_Results.php page. The errror is:
MySQL Error#: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 2

I am running the latest version of MAMP with the latest sql and PHP so I am not sure why I am getting this.

I would like to access the recordset so I can try to modify it for cross selling products.

Thanks.

Regards,
Rob

Sign in to reply to this post

Jason ByrnesWebAssist

The recordset on the Products_Results.php page is to complex for Dreamweaver to process.

The only way you will be able to edit that recordset is directly in the code, you will not be able to edit it using the Dreamweaver interface.

Sign in to reply to this post

robert329616

OK.

Thanks Jason.

Rob

Sign in to reply to this post

Paul

Jason,
I just posted a question on this...should have searched first.

If it is too complex for Dreamweaver to process, how do I add the ProductID field directly above the WADAProducts.ProductPrice field in the Products_Detail.php page?

I'm using Options, and would like the customer to see which Item # they are looking at when the select a different option.

Here is the code (I put the words "ProductID Here" to show you where I would like it to go):
I would also like to make the Options field wider if possible. It is too short to see all the info.


<div id="addFields" <?php echo(($row_WADAProducts["NumLeft"] > 0 || $row_WADAProducts["ProductUnlimited"] != 0)?'':'style="display:none"'); ?> >
<input type="hidden" name="WA_Store_Cart_1_ID_Add" id="WA_Store_Cart_1_ID_Add" value="<?php echo $row_WADAProducts["ProductID"]; ?>" />
ProductID Here
<h2 id="ProductPrice">$<?php echo number_format($row_WADAProducts["ProductPrice"], 2); ?></h2>

<input type="image" src="Images/btn_addtocart.png" border="0" value="Add to Cart" name="WA_Store_Cart_1_ATC" align="absmiddle" />
<label>Qty:</label>
<input type="text" name="WA_Store_Cart_1_Quantity_Add" value="1" size="2" align="absmiddle" />
<!--
<br />
<a href="#"><img src="Images/btn_learnmore.png" width="111" height="22" alt="Learn More" style=" margin-top: 4px;" /></a>
-->
</div>

Thanks

Sign in to reply to this post

Jason ByrnesWebAssist

use:
<?php echo $row_WADAProducts["ProductID"]; ?>


to output the product ID to the page.

Sign in to reply to this post

Paul

And if I wanted to show the Category below the product name, is it this?

<?php echo $row_WADAProducts['ProductCategory']; ?>

Thanks

Sign in to reply to this post

Jason ByrnesWebAssist

No, use:
<?php echo $row_WADAProducts["CategoryName"]; ?>

Sign in to reply to this post

Paul

Jason,

It is not showing anything.
Here's the link: Products_Results.php
Learn More about any of the products. You'll see that above the price I put:

Category:

Item #:

The item # shows up, but not the category.

Not sure why, but the item number field has single quotes around the field name PRODUCTSKU: Item #:&nbsp;<?php echo $row_WADAProducts['ProductSKU']; ?>
But the CategoryName has double quotes.

Thanks

Sign in to reply to this post

Jason ByrnesWebAssist

Change the sql for the WADAProducts recordset from:

$query_WADAProducts = sprintf("SELECT * , (ProductStock - (SELECT Coalesce(Sum(DetailQuantity),0) FROM orderdetails INNER JOIN orders ON OrderID = DetailOrderID WHERE DetailProductID = ProductID AND OrderDate > ProductUpdateDate))*ProductLive AS NumLeft FROM products  WHERE ProductID = %s OR ( -1= %s AND ProductID= %s)", GetSQLValueString($ParamProductID_WADAProducts, "int"),GetSQLValueString($ParamProductID2_WADAProducts, "int"),GetSQLValueString($ParamSessionProductID_WADAProducts, "int"));




to:

$query_WADAProducts = sprintf("SELECT *, (ProductStock - (SELECT Coalesce(Sum(DetailQuantity),0) FROM orderdetails INNER JOIN orders ON OrderID = DetailOrderID WHERE DetailProductID = ProductID AND OrderDate > ProductUpdateDate)) AS NumLeft, (SELECT MAX(ProductPrice) FROM products as prod2 INNER JOIN productoptions ON productoptions.ProductID = prod2.ProductID WHERE  productoptions.GroupingID = products.ProductID AND prod2.ProductLive <> 0) AS TopPrice, (SELECT MIN(ProductPrice) FROM products as prod2 INNER JOIN productoptions ON productoptions.ProductID = prod2.ProductID WHERE productoptions.GroupingID = products.ProductID AND prod2.ProductLive <> 0) AS BottomPrice FROM products  LEFT OUTER JOIN productcategories ON ProductCategoryID = CategoryID  WHERE ProductID = %s OR ( -1= %s AND ProductID= %s)", GetSQLValueString($ParamProductID_WADAProducts, "int"),GetSQLValueString($ParamProductID2_WADAProducts, "int"),GetSQLValueString($ParamSessionProductID_WADAProducts, "int"));
Sign in to reply to this post

Paul

Thanks, Jason!

That worked.

The only thing is the Item # doesn't change when you select a different option. Even when a person has multiple items in the cart.php page, it shows the same item # for all of the items.

Paul

Sign in to reply to this post
loading

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