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.

... ... .. why does every customer have their own table?

... ... .. 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

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)

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)

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)

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)

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?

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.

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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.