Click here to Skip to main content
15,885,825 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello guys

My objective is to create an online Inventory management program for multiple business company. But i've got stuck in the database create.

I have created a database in phpmyadmin named "stock" with tables "users" and "stock". So when multiple users register to my site, one should only gain access to his unique "stock" table in the database.

How can i do that? shoudl I create multiple tables "stock" and assign every user_ID to it. I cannot have only 1 tale "stock" to multiple users, it won't work

Please give me a solution for that thanks! :D

A responce will be appreciated
Posted

If you created a separate series of tables for each company, you would be creating new tables and modifying the software each time a new company was enrolled. By using only one series of tables, the companies using the application can expand and shrink without requiring software changes.

My suggestion:

I would have only one table for each type of data (user, stock, open orders, invoices, etc.) and have an identifier column (e.g. Company Code) in each table that identified which rows belong to which company.

Every SELECT and UPDATE should contain the identifier column in the Where clause (e.g. Where CompanyCode=@COMPANYCODE) as one of the conditions. The @COMPANYCODE value would be put into an SQLParameter object as would the other values used in the Where conditions.

All INSERT statements should insert the identifier column belonging to the corresponding user's company.
 
Share this answer
 
hi there..I do appreciate your response but am too a newbe in PHP and mysql do do such things XD I am using Dreamweaver to automatically connect to my server database without any written php code lol am a bit confuse abt "identifier column" lol

But anyway do you have skype?? so u can explain me how to do that :D

thnxx
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900