hance2105 Posted June 21, 2013 Share Posted June 21, 2013 hello guys, i have a login table where customer and retailer logins are stored. roles that are defined in the table are retailer and customer next to each login details.customers and retailers both are given user_ids when registering. since i have many retailers who will add the same products but with different product details and prices, i want to know how to differentiate between those retailers when they add products. it will be much easier to do a query by retailer then.every product added are stored in the tbl_product table in the database. queries are done from that table.suppose retailer A has added product A, retailer B has added product A as well but with a different description and a different price.is it possible? can i have a tutorial somewhere? Quote Link to comment https://forums.phpfreaks.com/topic/279411-adding-products-by-retailer/ Share on other sites More sharing options...
denno020 Posted June 21, 2013 Share Posted June 21, 2013 It's not difficult at all. All you need to do is have a field in your products table which is the ID of the retailer in the users table (which I think from your comments is called user_ids). That way the two tables are linked through the retailers ID, and you can get all of the retailers information and all of their products in one hit. Quote Link to comment https://forums.phpfreaks.com/topic/279411-adding-products-by-retailer/#findComment-1437187 Share on other sites More sharing options...
Barand Posted June 21, 2013 Share Posted June 21, 2013 I can understand that retailers would have different prices but why would descriptions of the same product be different for each retailer? More likely the model would be more like this +------------+ +--------------+ | retailer | | product | +------------+ +--------------+ | user_id |----+ +------------------+ +-----| product_id | | user_name | | | retailer_product | | | prod_name | | etc | | +------------------+ | | prod_desc | +------------+ +---<| user_id | | | manufacturer | | product_id |>---+ | product_code | | price | | etc | +------------------+ +--------------+ Quote Link to comment https://forums.phpfreaks.com/topic/279411-adding-products-by-retailer/#findComment-1437218 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.