Hey anyone tell me the method of storing data in sessions and cookie. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Hey anyone tell me the method of storing data in sessions and cookie.

i want to save user id in my project when user login.

15th Jan 2018, 8:01 PM
Dipesh Basnet
Dipesh  Basnet - avatar
3 Answers
+ 1
u have to start session first session_start () then I have to store your user of in session $_SESSION ['user_id'] = $userId // your user of
22nd Jan 2018, 7:37 PM
fahim
+ 1
thank you my friend for your suggestions but i want to know about storing data in sessions and cookies not in database.
22nd Jan 2018, 5:47 PM
Dipesh Basnet
Dipesh  Basnet - avatar
- 1
use a database. skip cookies for now. doesnt sound like you need to use them based on your question.
19th Jan 2018, 5:19 AM
Alvin Milton
Alvin Milton - avatar