If I have a cart table for example with a list of cartIDs and Customer ID which is linked to a car开发者_开发技巧t details table which contains the products for each cart etc.
If I want to output the cart for the user currently logged in would doing something like work?
SELECT FROM tblCart [CartID] AND tblCartDetail [title], [price],[image]
WHEN CustomerID=CurrentlyLoggedInID
I know the SQL isn't correct but would that idea work? Or would it just output the whole cart for when the two values match?
I believe what you're looking for is called a SQL join.
Use a parameter, so CustomerID = @CurrentlyLoggedInID. Then set the parameter equal to the membership.getuser() string.
精彩评论