Hi,
This may be a broad problem but, I figured I would ask.
I have a product review section. I have one table consisting of the product# and product name. I have another which holds the reviews and all the details of the author and text as well as the product number being reviewed.
My problem:
When a user comes to my site, he/she selects from a very long list of products in a drop down menu that shows the products alphabeticly by brandname (ie. Tonka-Dump Truck).
When the user selects the product he/she they press go and the site then lists all the reviews submitted for this product.
This all works ok, but my users are wanting some indicator of how many reviews are listed for each product. Some may have zero and others twenty or more as the database grows.
Question:
So what code can I use to count and display the number of reviews for each product#/product. I'd like it to be displayed in the same drop down menu. (ie. Tonka-Dump Truck (30 Reviews))
Since each review has the product number listed in it, I guess I'm looking for a loop to check products table, find the first record and then search the reviews db and count how many reviews are listed for that product number. Then display it in the menu.
#1001 (Tonka-Dump Trucks (30 Reviews)
#1002 (Tonka-Mini Trucks (21 Reviews)
I hope this makes sense and someone can offer me a simple solution that I can understand. I'am new at programming and PHP overall, but I enjoy it and have found it hard to find a solution for this in a working example for my setup.
John