Re: newbie help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You could do separate databases if you want.   It all depends on how you want 
to organize your data (keeping in mind data backup strategies and stuff).

Using separate databases on the same server, you might have another database 
for the 'common' data.  Any variables you store in the database that don't 
really change and are common to all databases.  Or if you log anything and 
want to keep the log data in one central location, you could put it in the 
'common' database.


If you wanted to store all the data in one database, you could use something 
like forum threading techniques to show a parent/child relationship for the 
customers.


id      name                    parent
1       customerA            NULL
2       cust1                    1
3       cust2                    1
4       custB                   2
5       custC                   2
6       custD                   3


Then it's just a matter of drilling down, collecting a list of ID's for that 
customer and the sub-customers.

Lotsof ways to tackle this problem.

-TG



----- Original Message -----
From: nhadie <nhadie@xxxxxxxxxxx>
To: php-db@xxxxxxxxxxxxx
Date: Fri, 28 Sep 2007 11:30:42 +0800
Subject:  newbie help

> Hi All,
> 
> I would like to setup a system something like this
> 
>                                                                         
>          customer A
>                                                                         
>           /        \
>                                                                             
>   
>       cust 1        cust 2
>                                                                             
>   
>      /      \              \
>                                                                      
> cust B       cust C          cust D
> 
> customer A has customer 1 and 2, cust 1 has cust B and C etc, etc.
> what i'm after is when a  customer user logs in he can only see record 
> of its customer, e.g cust A logs in, it can only see records of cust 1 and 
> cust 2,
> if cust 2 is login it can only see cust D and so on
> 
> how would i approach this? should every customer have it's own database,
> consisting of all tables i need e.g customer detail table,
> and i will use the database name as session variable, so  that when they 
> add records it be inserted on table under that database?
> 
> sorry if my questions are confusing, hope anyone can help me, i just 
> need help on how to approach it at the beginning so it will not be messy 
> later on. Thank you.
> 
> Regards,
> Nhadie
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux