close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Do I need to create a seperate table for each product in MySQL?

Thread began 8/14/2013 12:33 pm by Jean | Last modified 8/16/2013 11:48 am by Jean | 552 views | 5 replies

Jason ByrnesWebAssist

The way you are creating the catalog pages is an inefficient use of a a database.

When suing a database, you don't need to create a separate page for each product, instead, you would create a results page that lists all products, and a details page to show the details of a specific product.

The Results page would have a link to the details page, and would pass the Product ID as a URL variable to tell the details page what product to show, for example:
product_details.php?ID=23

the recordset on the details page would be set up to filter the table based on the ID URL Variable:

for example
SELECT * FROM products WHERE productID = paramID

Variable:
Name: paramID
Type: Integer
Default Value: -1
Runtime Value: $_GET['ID']


The where clause on the recordset would return only the requested product.

In the way you have the pages created, you are creating a separate page for each product, but the recordset on each page does not have a where clause to tell the database which product it should return. This is causing the add to cart button to return the first product each time. if you do it this way, you need to explicitly tell the recordset which product record to return.

Edit the recordset on each page, in the filtering section, select the ID column and set the filter to 'Equals' 'Entered Value' and enter the ID number for the product to return.


For more details on creating a dynamic product catalog, we have some tutorial you may find helpful:

Getting Started With MySQL And Dynamic WebSites
Create a product catalog

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