Member Avatar


I am new to PHP and I would just like to know:

Is there a purpose for cookies if you handle sessions with the database?

I've been reading about cookies and trying to understand how they would be beneficial if I had sessions handled by the database, and I just saw no real purpose for them...


Recommended Answers

All 6 Replies

Member Avatar

You'll get more hits if you provide a contextual title.


they are very useful in many different ways but it seams you havent reached the place where you could get a full benefit of them

Cookies and Sessions seemed to be similar but those have many differents in properties

In Cookies, your given information like username and password should be stored in encrypted format. So, this will give high security for our login or transaction informations. But, you need to clear cookies immediately, because you should not give any more space to hackers to hack our personal datas. Hope you can understand. If still you feel any problems, let me know...

I guess you don't understand how sessions work.

Even when you store sessions in a database, a cookie stored on the clients browser is still needed to identify them.

I guess if you passed the session id with the url, you wouldn't need cookies (but this is very insecure and not recommended)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.