Jump to content


Photo

Temporary storage for database request


  • Please log in to reply
6 replies to this topic

#1 jeremiorama

jeremiorama
  • Members
  • PipPip
  • Member
  • 12 posts
  • LocationQuébec, Québec

Posted 06 October 2005 - 07:41 PM

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

-Jeremiorama

#2 craygo

craygo
  • Staff Alumni
  • Advanced Member
  • 1,973 posts
  • LocationRhode Island

Posted 06 October 2005 - 07:45 PM

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.

#3 jeremiorama

jeremiorama
  • Members
  • PipPip
  • Member
  • 12 posts
  • LocationQuébec, Québec

Posted 06 October 2005 - 07:47 PM

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

-Jeremiorama

#4 jeremiorama

jeremiorama
  • Members
  • PipPip
  • Member
  • 12 posts
  • LocationQuébec, Québec

Posted 06 October 2005 - 07:50 PM

Hey craygo,

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

Thanks,

-jeremiorama

-Jeremiorama

#5 ryanlwh

ryanlwh
  • Staff Alumni
  • Advanced Member
  • 511 posts

Posted 06 October 2005 - 08:13 PM

you can CREATE TEMPORARY TABLE.

or you can put the array into SESSION
Please use EDIT * 100...
Please use
or [php] * 1000...

PLEASE READ THE POSTED SOLUTIONS CAREFULLY * 1000000...

#6 jeremiorama

jeremiorama
  • Members
  • PipPip
  • Member
  • 12 posts
  • LocationQuébec, Québec

Posted 06 October 2005 - 08:38 PM

Hey thanks ryanlwh!

Your answer is what I was looking for.

-jeremiorama

-Jeremiorama

#7 neylitalo

neylitalo
  • Staff Alumni
  • Advanced Member
  • 1,854 posts
  • LocationMichigan, USA

Posted 07 October 2005 - 02:13 AM

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!
http://nealylitalo.net - My personal website, and home of The Netizen's Journal.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users