newbie help

newbie help

am 28.09.2007 05:30:42 von Nhadie

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

RE: newbie help

am 01.10.2007 22:05:54 von Daevid Vincent

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-da ta.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@tbgi.net.ph]
> Sent: Thursday, September 27, 2007 8:31 PM
> To: php-db@lists.php.net
> Subject: [PHP-DB] 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

RE: how to store a heirarchy of resellers and customers WAS: newbie help

am 01.10.2007 22:11:00 von Daevid Vincent

Also, you really should use a more descriptive subject line, 'newbie help'
is kind of weak. If everyone did that, nobody would be able to search
subjects or distinguish one topic from another.

I won't even get into the whole 'top/bottom post' B.S. (personally I think
top posting is great as you don't have to scroll. So you read bottom up if
you want to know the thread) Ooops. Sorry. I guess I did get into it a bit.
;-p

Something like, "how to store a heirarchy of resellers and customers"

> > -----Original Message-----
> > From: nhadie [mailto:nhadie@tbgi.net.ph]
> > Sent: Thursday, September 27, 2007 8:31 PM
> > To: php-db@lists.php.net
> > Subject: [PHP-DB] 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
>
>

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