My suggestion is that you create a customer table, for example, and at the time of login you save in the session the logged in customer id. Later, in queries, insertions, changes... Anyway, in the actions in the database, you should validate the client’s Id. For example:
In the client table you have the columns: Id, Name, CNPJ, Status.
In the product table you have the columns: Id, Name, Weight, Value, Customer.
When making the select of products, for example, you will use:
SELECT C.Nome AS Clietne, P.Nome AS Produto, P.Peso, P.Valor
FROM Produtos P
INNER JOIN Clientes C ON (P.IdCliente = C.Id)
WHERE P.IdCliente = $_SESSION['sIdCliente']
Very good :D there in the company my friend always does this to save the id and use it for everything, the problem I think, and that so this data becomes more vulnerable, no ? (I don’t know much about php)
– Murilo Melo
I don’t see vulnerability... I believe it depends a lot on the whole structure of the project... is not a value in the session that will leave your project vulnerable.
– Isa
tendi :D thanks for the clarification
– Murilo Melo
Don’t forget to dial in your answer if you solved your problem ;)
– Isa