Re: Imposing a range on what is stored in a session variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2009-07-27 at 07:44 -0700, Miller, Terion wrote:
> Well there are currently about 17000 records in the db, and my manager wants to have it only pulling in 1000 at a time as a session range
> And why do my code snippets always look so messed up , I put them in using the rich text or html settings in my Entourage mail...
> They look fine when I send them and then crazy when I see them on a post reply...
> Anyways...it's one of those mondays where when we left on Friday all our pages were working brilliant and now they are all doing strange things, like trying to save instead of open
> And boss thinks it's the server strain and we need ranged sessions...would my thinking on using the foreach(range work though?
> 
> 
> 
> On 7/27/09 9:34 AM, "Bastien Koert" <phpster@xxxxxxxxx> wrote:
> 
> On Mon, Jul 27, 2009 at 10:30 AM, Miller,
> Terion<tmiller@xxxxxxxxxxxxxxxxxxxx> wrote:
> > I want to store only 1000 records at a time in the session variable thought I could use a range(1,1000....
> >
> > How would you do this, store the first 1000 , then the second on refresh etc
> >
> > My snippet so far
> >
> > -----------------------
> >                                            // Process all results into $_SESSION array                                                                       $position = 1;                                                                            while ($row = mysql_fetch_array($result))                                      {                                      $_SESSION['fullRestaurantList'][$position] = $row;                                      $position++;                                                                             foreach(range('1','1000') as $c){                                                   ($position == $c)
> >                                                    $_SESSION['totalNumberOfRestaurants'] = $c;                                      }                                                                                                                                                    }
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> 
> 
> Teri,
> 
> Do you really need that data to persist? This will not scale effectively.
> --
> 
> Bastien
> 
> Cat, the other other white meat
> 
> 
> 

The clue to the email formatting is in the list rules if I'm not
mistaken. I believe they say something about sending emails as plain
text, not formatted text, and in any case, the mailing list converts
them all to plain text anyway, hence the messed up appearance.

As to your question, why does your boss think that sessions are the way
to go for this? Doing the limit in the query will be a lot faster and
will need less memory.

Thanks,
Ash
http://www.ashleysheridan.co.uk


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux