user2688737
user2688737

Reputation: 51

Update my session variables

How do I update my session variables without having to log out?

I have this session array that has to be updated:

$data_for_analog_meter = $_SESSION['data_for_analog_meter'];

Any idea is appreciated!

Upvotes: 1

Views: 88

Answers (2)

Jason OOO
Jason OOO

Reputation: 3552

First don't forget to session_start() when you update it, I assume that you started it at the top of that page, and then:

  $_SESSION['name'] = 'NEW VALUE';

Upvotes: 0

Sudhir Bastakoti
Sudhir Bastakoti

Reputation: 100195

you're assigning session value to variable, you need to do the reverse, to update session value you need to do:

$_SESSION['data_for_analog_meter'] = $data_for_analog_meter;

Upvotes: 1

Related Questions