473,406 Members | 2,956 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Shopping Cart and Products relationships

Hi everyone,

This is probably a very easy question:

I have a shopping cart table and two products tables (legacy reasons...).

I need to create a relationship between the ShoppingCart table and the two products tables such that no products are entered in the Cart which don't exist in either product table 1 or product table 2.

Any ideas? I guess i could put this constraint the stored procedure which inserts things in the cart but i suspect this would not be very efficient...

Thanks heaps,

LJ.
Aug 8 '07 #1
1 1806
ck9663
2,878 Expert 2GB
Hi everyone,

This is probably a very easy question:

I have a shopping cart table and two products tables (legacy reasons...).

I need to create a relationship between the ShoppingCart table and the two products tables such that no products are entered in the Cart which don't exist in either product table 1 or product table 2.

Any ideas? I guess i could put this constraint the stored procedure which inserts things in the cart but i suspect this would not be very efficient...

Thanks heaps,

LJ.
i'd say, on the contrary, that's how you should do it. FOREIGN KEY constraint is designed exactly for that reason...or you can re-invent the wheel and create a trigger and rollback the insert if it fails your condition
Aug 9 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Phil Powell | last post by:
I need a back-to-basics shopping cart tutorial in PHP/mySQL. I thought I had it down and I failed, as usual. Here is what I mapped out as a spec: 3) initial work on bestilling.php to contain the...
4
by: mimages | last post by:
I can't figure this out. There are too many differences between my installation of osCommerce and what I read on these forums, and in the contributions' readme files. I have either lost my logical...
0
by: Simon Harris | last post by:
Hi All, I have written a page that generates a site map of all categories and products within a shopping cart system. It works a treat, apart from being toooo slooow. The code is below, can...
1
by: Adil Akram | last post by:
I have created a site shopping cart in ASP.net. I am using ASP session object's SessionID on non SSL connection to track session. While adding products to cart DB I insert product and SessionID...
2
by: Guadala Harry | last post by:
I'm looking to implement some *minimal* shopping cart. I've looked at a few 3rd party packages, and they're all way too involved for what I need. So, I'm thinking it might make sense to roll my...
2
by: G.E.M.P | last post by:
High Level Session Handling Design for a Shopping cart 0) What am I missing? 1) How does OSCommerce do it? I'm thinking about building a shopping cart from scratch, using a library of dynamic...
4
ak1dnar
by: ak1dnar | last post by:
Hi, I am Building small shopping cart that enables customers to select books from the list and Add it to the Cart. When i click Add Button the Cart Should Update with these things. No of...
1
by: jecha | last post by:
I'm implementing a shopping cart but am having a problem in checking out a person who has added item in his/her shopping busket.The code for the checkout.php script is given below <?...
1
by: Infused | last post by:
Here is the problem I need a solution to. I do not have much experience in dealing with shopping carts I've setup a few but nothing this elaborate. I have a client that is dealing with multiple...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.