View Single Post
Old 10-24-2007, 09:52 AM   #2 (permalink)
bluesaga
Super Moderator
Advanced Programmer 
 
bluesaga's Avatar
 
Join Date: Sep 2007
Posts: 165
Thanks: 0
bluesaga is on a distinguished road
Default

You are doing this in an un-normalised approach:

Instead of creating a new table for each group, add an extra column to the table like this:
id, contract, group

Then in your mysql queries whenever you want to define a specific group:
SELECT * FROM contracts WHERE group=1

That would pull all contacts from group 1.

You can do an auto table if you want but this is far better, to do an auto table you would do a php loop with a mysql insert query the query would look somewhat like:

Code:
INSERT INTO contract1 (id, contract) VALUES (SELECT id, contract FROM contract WHERE group = 1)
bluesaga is offline  
Reply With Quote