This may be overkill for what you're doing, but based upon your layout, you might consider a nested set. Since you're a newb, it may be too complex to code: http://dev.mysql.com/tech-resources/articles/hierarchical-data.html This is how you setup products and categories for example I think your solution is much simpler and could simply use a few "glue tables" and some flags so you know which table to look in (reseller, customer, etc) > -----Original Message----- > From: nhadie [mailto:nhadie@xxxxxxxxxxx] > Sent: Thursday, September 27, 2007 8:31 PM > To: php-db@xxxxxxxxxxxxx > 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