php - Unable to get session contents in second function -
i having issues sessions.
in first function queue
, save session entries
can print out function, can see being set correctly.
in function remove
, try , save entries session variable , error entries
undefined index
.
does have ideas doing wrong here?
function queue() { session_start(); $status = 'awaiting moderation'; $channel = '1'; // find entries in 'gallery' channel 'awaiting moderation' status $this->ee->db->select('entry_id') ->from('exp_channel_titles') ->where('status', $status) ->where('channel_id', $channel); $query = $this->ee->db->get(); $entries = $query->result_array(); $entries_count = count($entries); // set count $_session['entries_count'] = $entries_count; // if entries found if ($entries_count > 0) { // flatten entry ids array $entriesflat = array(); array_walk_recursive($entries, function($a) use (&$entriesflat) { $entriesflat[] = $a; }); $entriesserial = serialize($entriesflat); // save in session $_session['entries'] = $entriesserial; } } function remove() { session_start(); // session data + save variable $entries = $_session['entries']; }
you can have 1 session , should @ top of file.
Comments
Post a Comment