Welcome Guest, Not a member yet? Register   Sign In
Hierarchy and authentication
#1

[eluser]Unknown[/eluser]
Hi,
I have this db structure:

tbl_users [*id_user, username, password, ...] for authentication purposes
|
- tbl_companies [*id_company, id_user, name, ...]
|
| - tbl_products [*id_product, id_company, product_description, ...]
|
| - tbl_employees [*id_employee, id_company, name, surname, ...]
|
| - tbl_access_cards [*id_card, id_employee, card_number, ...]

Bold = parent ids

In the admin area, when an user is logged, in my application I have
$this->user = array(record from tbl_users)

Now with $this->user['id_user'] the application can easily create, update, and delete from tbl_companies (2° level) without losing the hierarchy, since there is 'id_user' in that table.

But how can I insert/modify records into tbl_products, tbl_employees, or tbl_access_cards if I have $this->user['id_user'] and not the other parent ids?

For example, I can't create a new record in tbl_access_cards, because I need the id_employee...

What's your suggestion?




Theme © iAndrew 2016 - Forum software by © MyBB