Hi list,

I'm working on a project which uses a MySQL database to store some data. The
database looks something like this:

- id (PK)
- name
- sector_id -> Sectors (id)
- etc

- id (PK)
- company_id -> Companies (id)
- name
- etc

- id (PK)
- name
- etc

And we're using a Session to store references (not actual PHP references
ofcourse just the identifying integers) to these tables.

For example a list of companies and locations which are selected in the GUI is
kept in the session state.

The session would look something like this when filled up. The integers are the
PKs of the companies and sectors tables respectively.

Companies = Array (1,2,3,4,etc)
Sectors = Array (1,2,3,4,etc)

The problem is: when there are 2 clients one administrative and one user,
and the user has selected a company (or something else, it doesn't really
matter). And then the administrative user comes along and deletes the row which
the user just selected from the company table. There is an invalid reference in
the Session of the user.

I figured if I saved the session in the database and used constraints (foreign
keys) to enforce this. This could work. However, the PHP session abstraction
makes it very difficult to implement this properly. (I looked at

How do you guys deal with this problem?



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

Reply via email to