close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Displaying number of records next to category name.

Thread began 3/23/2015 10:42 am by FrankJay | Last modified 3/24/2015 10:00 am by Jason Byrnes | 780 views | 3 replies |

FrankJay

Displaying number of records next to category name.

I have a classified adverts page. On the left-hand column is a list of category names being displayed from a recordset. When a category name is clicked, a list of records displays in the right-hand column based on the results of the second recordset.

I would like to have the number of records displayed next to each of the category names in the left-hand column navigation.

This is something totally new for me and need some guidance of how to implement this functionality.

I'm not too sure if I need to add a third recordset to this page to implement the functionality required. If so, some pointers about the creation of this recordset and the filters needed to get the number of records.

Greatly look forward to advice and process to follow to implement this functionality.

Sign in to reply to this post

Jason ByrnesWebAssist

you need to use a join query to join the category table to the listing table and use the count() function to count the listings.


Lets use the items and itemcatagory tables from the blue sky music database as an example:
http://www.webassist.com/webassist/actions/do_download.php?file=25/94/blue_sky_music.zip&from=/community/tutorials/view_tutorial.php

using the following query:

SELECT itemcategory.*, count(items.itemID) as itemCount
FROM items
INNER JOIN itemcategory ON itemcategory.ItemCatID = items.ItemCatID
GROUP BY itemcategory.ItemCatID



would give the following results:

+-----------+-------------+-----------+
| ItemCatID | ItemCatName | itemCount |
+-----------+-------------+-----------+
| 1 | CD | 6 |
+-----------+-------------+-----------+
| 2 | Gear | 5 |
+-----------+-------------+-----------+



so the itemCount column has the number of items for each category

Sign in to reply to this post

FrankJay

Now working

Thanks Jason,
Spot on example recordset to get my required functionality.

I removed my original categories recordset and replaced with your recordset sample.

I just added my required filtering to the recordset.

It works perfectly.

Appreciate your help Jason

Sign in to reply to this post

Jason ByrnesWebAssist

you're welcome.

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