complex problems

Thread Solved

Join Date: Apr 2009
Posts: 82
Reputation: itisnot_me is an unknown quantity at this point 
Solved Threads: 5
itisnot_me itisnot_me is offline Offline
Junior Poster in Training

complex problems

 
0
  #1
May 4th, 2009
first off let me explain what is going on. i am creating a site that uses a shared DB and every customer that we have will have there own table. they can have other login's which will within there company table (employee logins).

How would you go about and check against every single table and see who is with what company so i can grab there information for that company.
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 1,402
Reputation: ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light 
Solved Threads: 225
Sponsor
ShawnCplus's Avatar
ShawnCplus ShawnCplus is offline Offline
Code Monkey

Re: complex problems

 
0
  #2
May 4th, 2009
... ... .. why does every customer have their own table?
GCS d- s+ a-->? C++(++++) UL+++ P+>+++ L+++ E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 82
Reputation: itisnot_me is an unknown quantity at this point 
Solved Threads: 5
itisnot_me itisnot_me is offline Offline
Junior Poster in Training

Re: complex problems

 
0
  #3
May 4th, 2009
Originally Posted by ShawnCplus View Post
... ... .. why does every customer have their own table?
That is the best way i can thing to keep everything organized. and not run into problems like people getting other peoples data
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 1,402
Reputation: ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light 
Solved Threads: 225
Sponsor
ShawnCplus's Avatar
ShawnCplus ShawnCplus is offline Offline
Code Monkey

Re: complex problems

 
0
  #4
May 4th, 2009
I'd be willing to bet there is a major design flaw if every customer having their own table is the solution. Relational databases are relational for a reason so tables can form relationships based on primary and foreign keys.
these tables for example (not real SQL commands, just examples)
  1. Customer
  2. id INT(10) AUTOINC PK --
  3. name VARCHAR(50) |
  4. |
  5. CustomerCompanyMap |
  6. customer_id FK ----------'
  7. business_id FK ----------.
  8. |
  9. Business |
  10. id INT(10) AUTOINC PK ---'
  11. name VARCHAR(50)

Creates a many to many relationship between companies and customers (companies can have many customers and customers can have many companies)
GCS d- s+ a-->? C++(++++) UL+++ P+>+++ L+++ E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 82
Reputation: itisnot_me is an unknown quantity at this point 
Solved Threads: 5
itisnot_me itisnot_me is offline Offline
Junior Poster in Training

Re: complex problems

 
0
  #5
May 4th, 2009
Originally Posted by ShawnCplus View Post
I'd be willing to bet there is a major design flaw if every customer having their own table is the solution. Relational databases are relational for a reason so tables can form relationships based on primary and foreign keys.
these tables for example (not real SQL commands, just examples)
  1. Customer
  2. id INT(10) AUTOINC PK --
  3. name VARCHAR(50) |
  4. |
  5. CustomerCompanyMap |
  6. customer_id FK ----------'
  7. business_id FK ----------.
  8. |
  9. Business |
  10. id INT(10) AUTOINC PK ---'
  11. name VARCHAR(50)

Creates a many to many relationship between companies and customers (companies can have many customers and customers can have many companies)
Ok so what i get from that is i should have a central login table which includes the company_id when create a _session with it. then with all of the data on another table i should include the company id so that i can recal it later?
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 1,402
Reputation: ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light 
Solved Threads: 225
Sponsor
ShawnCplus's Avatar
ShawnCplus ShawnCplus is offline Offline
Code Monkey

Re: complex problems

 
0
  #6
May 4th, 2009
Originally Posted by itisnot_me View Post
Ok so what i get from that is i should have a central login table which includes the company_id when create a _session with it. then with all of the data on another table i should include the company id so that i can recal it later?
Like I said, that's just an example. I'd have to see what your current design is to know how to fix it.
GCS d- s+ a-->? C++(++++) UL+++ P+>+++ L+++ E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 82
Reputation: itisnot_me is an unknown quantity at this point 
Solved Threads: 5
itisnot_me itisnot_me is offline Offline
Junior Poster in Training

Re: complex problems

 
0
  #7
May 4th, 2009
Originally Posted by ShawnCplus View Post
Like I said, that's just an example. I'd have to see what your current design is to know how to fix it.
i have not built it yet. I was still in the pre building process and didn't know how to go about doing it.

Thanks alot.
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 1,402
Reputation: ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light 
Solved Threads: 225
Sponsor
ShawnCplus's Avatar
ShawnCplus ShawnCplus is offline Offline
Code Monkey

Re: complex problems

 
0
  #8
May 4th, 2009
Well if you think of it more this way. Every noun should be a table, properties of that noun should be a column in said table. Ie., A customer would be a table and it has an id, and a name, etc. inf. Things that are that noun are a row in that table so if there are 4 customers lined up that's 4 rows in the customer table, not 4 tables since they're all customers just different values for their properties.
GCS d- s+ a-->? C++(++++) UL+++ P+>+++ L+++ E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC