| | |
complex problems
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Apr 2009
Posts: 82
Reputation:
Solved Threads: 5
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.
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.
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)
Creates a many to many relationship between companies and customers (companies can have many customers and customers can have many companies)
these tables for example (not real SQL commands, just examples)
PHP Syntax (Toggle Plain Text)
Customer id INT(10) AUTOINC PK -- name VARCHAR(50) | | CustomerCompanyMap | customer_id FK ----------' business_id FK ----------. | Business | id INT(10) AUTOINC PK ---' 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.
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.
•
•
Join Date: Apr 2009
Posts: 82
Reputation:
Solved Threads: 5
•
•
•
•
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)
PHP Syntax (Toggle Plain Text)
Customer id INT(10) AUTOINC PK -- name VARCHAR(50) | | CustomerCompanyMap | customer_id FK ----------' business_id FK ----------. | Business | id INT(10) AUTOINC PK ---' name VARCHAR(50)
Creates a many to many relationship between companies and customers (companies can have many customers and customers can have many companies)
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.
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.
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.
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.
![]() |
Similar Threads
- Outlook 2003 junk mail filter problems. (Windows Software)
- keyboard problems (USB Devices and other Peripherals)
- ibook startup problems no or white screen (OS X)
- I am having Seriour problems with IIS 5.1 Need Help! (Windows Servers and IIS)
- Router problems? (Networking Hardware Configuration)
- Problems getting rid of trojans and pop ups (Viruses, Spyware and other Nasties)
- Starting College 4/16 (IT Professionals' Lounge)
- Need Help with complex numbers (C++)
- Gabor filter (C++)
- 98, ME, and XP have problems seeing each other (Networking Hardware Configuration)
Other Threads in the PHP Forum
- Previous Thread: read second line or record of csv file
- Next Thread: in ie6 my site cannot fetch the result sometimes
| Thread Tools | Search this Thread |
apache api array basic beginner binary broken cache cakephp checkbox class cms code computing confirm cron curl customizableitems database date delete display dynamic echo email error external file files filter folder form forms forum function functions gc_maxlifetime google headmethod host howtowriteathesis href htaccess html iframe image include insert ip javascript joomla limit link login mail malfunction memmory memory menu mlm multiple mysql navigation oop parsing paypal pdf php phpmysql problem query question radio random recursion remote script search select server sessions sms snippet source space sql syntax system table thesishelp trouble tutorial update upload url validator variable video web youtube






