Jump to content

Archived

This topic is now archived and is closed to further replies.

jeremiorama

Temporary storage for database request

Recommended Posts

Hi there!

 

I'm having a little problem here dealing with a MySQL database, but this question is not about MySQL, so I posted it here.

 

What I'm trying to do is keep a database request in a temporary storage place (if it can be done) so that I can use the data put there while the user surfs the web site.

 

O.K. To be a bit more understandable, let's put it that way:

The user has several choices, and when the user clicks on one, a request is made to the database and the data is put in an array (sometimes big arrays). I would like this array to be kept, so the user can continue browsing and does not need to reload it all the time he needs to access to it, let's say, when he turns the pages of the contents or when he decides to come back to its initial choice.

 

If you have any questions, let me know.

 

Thanks for your help!

 

-jeremiorama

Share this post


Link to post
Share on other sites

you can store the arrays in a temporary table which should stay active as long as the person does not close the browser or you close the mysql connection in your code.

Share this post


Link to post
Share on other sites

Ok, just some more questions. I know this forum is about PHP but since MySQL is it's most used database, then i'll just ask, if anyone knows.

 

Let's say I receive 100 results from the database with my query. I put 10 results per page. What should I do so that I do not need to reload the same query all the time and only show 10 of the 100 results given everytime?

 

I was thinking of putting it in an array, and save this array, so that the user can "turn" the pages and would not query the database anymore.

 

But I could get results like a year's registry of a company phone calls, so I think cookies would not do it, would they?

 

Thanks,

 

-jeremiorama

Share this post


Link to post
Share on other sites

Hey craygo,

 

Yes, that's what I was thinking about. I should create a new table in my database instead of cookies?

 

Thanks,

 

-jeremiorama

Share this post


Link to post
Share on other sites

you can CREATE TEMPORARY TABLE.

 

or you can put the array into SESSION

Share this post


Link to post
Share on other sites

Please take care to post in the correct forum - read the descriptions of each board below the board's title. I've moved this one to MySQL Help. Thanks!

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.