Write to the bank who edited the profile

0

I am developing a system that registers employees of companies.

In this system I have the employee and user tables.

Employees table I have the data

id|nome|empresa|data_cadastro|user_view|user_edit

User table I have the data

id|nome|empresa

User accessing the system with email and password, saves the user ID session.

I would like when users view the employee's profile, it writes its ID to the employee's table in the user_view column. Which in the case are at least 5 users, to know who saw each profile.

How to write to the employee table? To view which users have already viewed your profile. Same function to know if the employee profile was edited by any user. I can write one ID at a time through an Insert in the table, but how to write multiple IDs in a single column, or another way that can perform the same process.

    
asked by anonymous 15.08.2017 / 21:04

2 answers

1

In this case, you need to create a new table where you will put the user id and also the user id and when it accesses you will record the users who will see it because you can not record several IDs in the same field.

You would have to create a text field and save type an XML but many databases this will have a limit and you would also have a lot of manual work in this second hypothesis.

    
15.08.2017 / 21:19
1

I think the ideal would be to create a new table and in it every time someone requests this page, you record the user id and the data you need, to easily find, type, you could create a management screen where the user responsible for the query and get the logs thereof .. Did you want something like audit? to know who changed the registration?

You also have to think about "growth" and if the company has more users? In that way that you passed, you will need to add another field in the table and then if it has many users it would be impractical .. and that way you suggested I do not see a way to record all accesses ... without creating an Access Logs table ...

    
15.08.2017 / 21:14