Site & DB structure

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
wizzard81
Forum Commoner
Posts: 66
Joined: Wed Jan 15, 2003 6:05 am
Location: Belgium
Contact:

Site & DB structure

Post by wizzard81 »

Hi,

I'm newbie in php and i'm currently working on my site.

Well i will some advertising options (paying) and trials free. I need some advice to setup my db structure.

I have this tables

customers
products
orders
orders_products
trials

My question is i don't want to let trials stored in my customers because they are only customers if they choose for paying advertising on my website.

Also another problem i maybe will have is when i run a second site on the same db and the same customers advertise on a second site and they want to change their info only for the second site then i don't know how i can fix this? Do i have to store the customers 2 times then so they can change like their address on one site and not on the other?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

You could just add a column in `customers` that sets which site the customer is for. You should have a column like that in all your tables. This, of course, means you should also have a `websites` table to map the website name to an id or a number.

You could make another table called `trial_customers` and just store trial customers in there.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
wizzard81
Forum Commoner
Posts: 66
Joined: Wed Jan 15, 2003 6:05 am
Location: Belgium
Contact:

Post by wizzard81 »

Thanks pickle for the advice.
Post Reply