RE: LIMIT and SESSION WAS: What is this called?

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

 



> -----Original Message-----
> From: Wolf [mailto:lonewolf@xxxxxxxxx] 
> Sent: Monday, July 06, 2009 8:10 AM
>
> Basically, go smack whomever told you to load all that stuff 
> into a session.  It's a paging query that you want to do, but 
> I'd not recommend doing it to store it in a session.
> 
> You can store all that stuff into a session, but you risk 
> putting a greater load on the users session then you would be 
> putting on the database server.

http://dev.mysql.com/doc/refman/5.0/en/select.html

You want to use "limit".

As for storing all the results, there most likely isn't a reason to, however
if you must do it that way (perhaps you have a << and >> button or something
to step through), then I suggest you save the __row ID's only__ in a
$_SESSION array variable and do a SELECT via the ID (and "LIMIT 1" can't
hurt either in case you're storing a SKU_ID or some other unique key but
it's not a primary key) as you're stepping. This way your bulky query is
only done once. This is a more advanced technique however and may be
confusing to you if you don't know what you're doing. 

You can also pull all these items faster on subsequent pages by doing an
"WHERE item.id IN ($myarray)" type of deal (pseudo code of course). 


-- 
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