Carrying values from one page to another

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
shwathi
Forum Newbie
Posts: 6
Joined: Mon Mar 15, 2004 12:29 am
Contact:

Carrying values from one page to another

Post 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)
TheBentinel.com
Forum Contributor
Posts: 282
Joined: Wed Mar 10, 2004 1:52 pm
Location: Columbus, Ohio

Re: Carrying values from one page to another

Post 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.
Post Reply