I am trying to insert data into specific table by user session and group.
The tables are users
, workers
, help
.
Structure of table "users":
id | username | password | group
---+----------+----------+---------
1 | john | 123 | workers
2 | david | 123 | help
Structure of table "workers" and "help":
id | username | message
I finished login with session pages and include session onto every page. So when the user login it check and display from "user" table session: Hello "user"
The problem is with "insert into" statement, when john or david logs in and then they post something into database.
Which is the best way to create insert into statement so if it's john all insert into will go into "workers" and if it's david all insert into will go into "help"?
workers
? And can you clear if you want a log table for the session or do you want to write in the tableworkers
only when thegroup
for the current username beworkers
?. Anyway, why don't you make a table with the group_id and you can log every message for any user, not splitting them in tables likeworkers
,help
or whatever.