Click here to Skip to main content
13,148,260 members (58,134 online)
Rate this:
Please Sign up or sign in to vote.
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 12-Feb-13 6:47am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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


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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.170924.2 | Last Updated 13 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100