close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Adding 'Category' name to product_results.php page

Thread began 7/07/2015 2:23 pm by Charles | Last modified 7/09/2015 1:40 pm by Ray Borduin | 167420 views | 4 replies |

Charles

Adding 'Category' name to product_results.php page

I've generated product_results pages filtered by Category ID. Instead of just having 'Results' as the title of the page, I'd like to have the 'Category' Name appear. See my page:http://outofchaos.net/gsc/www/products_results.php?Category_ID=32
I've also attached the products_results.php file. Perhaps you could just suggest a line of code that would make the 'Category Name appear? Thank you.

Attached Files
products_results.php
Sign in to reply to this post

Ray BorduinWebAssist

First you would have to update the products recordset query to include the Category field by using an inner join:

SELECT categories.Category_Name, ID, Small_pic_Name, Product_Name, Product_Name, Description, Color FROM products INNER JOIN categories ON categories.Category_ID = products.Category_ID WHERE Category_ID = %s ORDER BY Product_Name ASC

Then you can display it on the page wherever you want like:

<?php echo($row_WADAproducts['Category_Name']); ?>

or course the column names are just guesses because I don't know your actual database table and column names.

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

Charles

I'm assuming I add this SQL Select statement to the DB. I adjusted your suggested syntax above to the actual column/db names:
SELECT category.Category, Category_ID, Small_pic_Name, Product_Name, Product_Name, Description, Color FROM products INNER JOIN category ON category.Category_ID = products.Category_ID WHERE Category_ID = %s ORDER BY Product_Name ASC

and I got the following error around the '%Order' part of the statement - #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 '%s ORDER BY Product_Name ASC
LIMIT 0, 25' at line 1 . . . . .What would you suggest? Thank you

Sign in to reply to this post

Ray BorduinWebAssist

You should have updated the SQL in code view in dreamweaver. It sounds like you may have opened the Recordset and changed it there. It would use another syntax in that case. Try using the old file attached to the previous post and update the SQL in code view in Dreamweaver and I think it would work.

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

Charles

That worked! Once I understood that I should be editing the existing MySQL query and got the column names references correct, it lit right up.
Thank you one more time!

Sign in to reply to this post

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