I was reading about sessions and cookies in php and I don't know which one is better to use
can anyone explain the difference ? thanks in advance
I was reading about sessions and cookies in php and I don't know which one is better to use
can anyone explain the difference ? thanks in advance
The main difference is that cookies live on the client and session lives on the server.
Cookies can be set to a long lifespan, which means that data stored in a cookie can be stored for months if not years.
Sessions are stored on the server, which means clients do not have access to the information you store about them - this is particularly important if you store shopping baskets or other information you do not want you visitors to be able to edit by hand by hacking their cookies.