Page 1 of 1

Carrying values from one page to another

Posted: Tue Mar 16, 2004 4:05 am
by shwathi
Hi,
I'm working with php and mysql. I have to do the following:

In page1 : Retrieving record 1 from mysql;
In page2 : Retrieving records 1,2 from mysql;
In page3 : Retrieving records 1,2,3 from mysql;
In page4 : Retrieving records 1,2,3,4 from mysql; .... so on

Each of these records are about 5KB of code.
If I store the index in session variable then I have to retrieve the same set of records again and again. This may not be efficient. Is it advisable to use session variables for storing such large data? How do I store the records that are so far retrieved in the client side and make it efficient?

Thanks in advance,
Shwathi 8)

Re: Carrying values from one page to another

Posted: Tue Mar 16, 2004 9:17 am
by TheBentinel.com
shwathi wrote:Hi,
I'm working with php and mysql. I have to do the following:

In page1 : Retrieving record 1 from mysql;
In page2 : Retrieving records 1,2 from mysql;
In page3 : Retrieving records 1,2,3 from mysql;
In page4 : Retrieving records 1,2,3,4 from mysql; .... so on
From a DB standpoint, it's not too disastrous to retrieve the same record over and over so long as you're doing it by a solid index. It's always faster to not retrieve data than to retrieve it, but it's not too bad. Unless you expect heavy usage (100+ simultaneous users) I doubt it's worth coding for.

Do you throw 5k down to the client each time? Or is the 5k just the record size and you actually only send the client a small chunk of that?

Storing the indexes in a session variable or a hidden field in the form would work for your purposes, I think.