Linking multiple Tables for temporary Data Retrieval
I am working on my College project, making an eShop using PHP and MySQL , most parts of my website are competed , there are some points which i am unable to manage.
My main problem now is to link two Tables of MySQL Database in such a way that by accessing 1st table i can get data from the 2nd table too , without writing a lot of MySQL and PHP coding , i know it is possible , but i am unable to do it properly!
This is what i am trying to accomplish:
=>I have three tables in MySQL, "products" ,"tempuser" and "reguser".
=>"products" includes Three main Rows, [id], [pid] and [brand]
-->[id] is *primary and *Auto Incremented (for DB use only)
-->[pid] is *Unique and is the Product ID(for product Identification and fetching)
-->[brand] includes the name of the products i am using(e.g Asus , Sony , Toshiba etc)
=>"tempuser" includes temporary users who have not yet signed in , but still interested in buying products.
-->it includes temporary information about users like , IP address , browser , Referrer etc.
-->it also includes the products, the user has added to cart(Temporary) or added to his wish list, but i don't want to INSERT the same data that already exists in "products" TABLE , so i just want to link the information to the "products" TABLE .
I could use DESIGNER located in PHP MyADMIN, but this only works when the two tables have Fixed number of rows , but in my case number of ROWS may Increase/Decrease depending upon the number if items the user has selected/Added to Cart.
I am also not sure what should I insert in the "tempuser", if a user adds two or more Items of the same brand to his Cart, or if he adds two or more Items of two or more products in his cart.
I mean without making a lot of rows , allotting Single Row for the Single Brand , which should include Quantity,pid and brand name in such a way that it can be matched with "products" table in case if a user clicks on the "Details of the product" button during the Checkout process.
I know my information is bit confusing , that is why i am sharing it with you , so that you could help me in resolving this small but Confusing issue.
Please explain its solution in light of your Experience and guide me to finish my project. This is not the Only issue in my website , but this is exclusively related MySQL .
If you need further information from me , please post here.