Welcome Guest, Not a member yet? Register   Sign In
Session class allow for arrays?

Hey folks,

Is it possible to set a session variable to contain an array of values? I'm trying to write a profile hit counter for http://www.f1autoimports.com/inventory which admins can view in the back-end.

I haven't thought of the most elegant formula for this task, but I'm thinking my best bet is to register a session with a vehicle_id. If a session exists with that vehicle_id set, do not increment the counter, else increment it. I think this will only be possible if I do something like:

$this->session->set_userdata('counter', $array['ids']);

I'd definitely appreciate any feedback on how you folks handle something similar.

- sf

Yes its possible. Haven't done it before in CI.

[eluser]Michael Wales[/eluser]
I've been mulling over the same problem as well. For instance, how does this forum know if you've viewed a post or not? It's not based off of timestamps, it's based off of actual views.

Maybe a session/database field with a delimited list of viewed item IDs (comma, pipe, whatever)? I dunno.

Theme © iAndrew 2016 - Forum software by © MyBB