Welcome Guest, Not a member yet? Register   Sign In
Storing items in a session array as the page loads
#1

[eluser]mattpointblank[/eluser]
Hi everyone.

I have a helper file which loads adverts on my site. It's used in several spots on the page and selects adverts to display from a pool of potential ones. Since the same advert can be booked into multiple positions on the site, I have to prevent the same ad from occupying more than one space on the site at a time.

On my old, pre-CI site, I did this using $_SESSION - every time I selected an ad for display, I added its filename to an array stored in the session. My query to get all the available ads included this code:

Code:
<?php
... "WHERE AdvertPath NOT IN('".implode("', '", $_SESSION['adsOnPage'])."')";
?>

This meant that each time the query ran, it excluded any ads that had already appeared.

I'm trying to reproduce this in CodeIgniter but having problems with CI's session functions. Basically, when I assign the advert ID to flashdata/userdata, it only writes the first one, then all subsequent ones don't seem to be added - some sort of overwriting issue I guess?

Is there a logical way anyone can see for me to add items to a session array as the page is loaded?

Thanks
Matt


Messages In This Thread
Storing items in a session array as the page loads - by El Forum - 08-14-2009, 10:01 AM
Storing items in a session array as the page loads - by El Forum - 08-14-2009, 10:33 AM
Storing items in a session array as the page loads - by El Forum - 08-17-2009, 05:05 AM



Theme © iAndrew 2016 - Forum software by © MyBB