what will be my outcome in this situation?

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
TooCrooked
Forum Newbie
Posts: 7
Joined: Fri Oct 27, 2006 6:17 am

what will be my outcome in this situation?

Post by TooCrooked »

lets say:
example wrote:@ 10:20AM DATABASE_1 has TABLE_1 with five records:
(format: "record number" = "value")
1=one
2=two
3=three
4=four
5=five
6=six
7=seven
8=eight
9=nine
10=ten

@ 10:21AM DATABASE_1 updates TABLE_1:
1-one
2-two
3-three
4-four
5-five
6-unos
7-dos
8-tres
9-quatro
10-cinco

@ 10:22AM, USER-A wants to sort the results of his 10:20AM query of TABLE_1 alphabetically.
So......

i know exactly how to make the events that occur at 10:20AM and 10:21 happen. no problem.

but, at 10:22AM, when user-A wants his alphabetic sort of his 10:20AM query, i need to know what my options are.. will:

- the 10:20AM query persist in "memory" of SQL... then my PHP script can somehow be programmed to access the 10:20 results (saved in SQL "memory"), sort them accordingly, and then return the results to be printed out on some web page

OR is it more like:

- in order to have any more access to the results of the 10:20AM query, you have to save the results into something (an array for instance), and then *somehow* pass the array from current PHP page to the next PHP page that will do the sorting. all this because SQL (when being talked to from PHP) can only be referenced in "instances", and not as a "session"

... this is as well as i can put my question. please help!
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Once the data has been modifed by UPDATE you'll lose the old data.

Do you care to elaborate on the specifics of your needs here? It sounds as though you should perhaps be logging transactions if you need to keep a constant log of the history of the information in the database at any one time.

FYI, MySQL can run operations triggered by UPDATE queries (hint).
TooCrooked
Forum Newbie
Posts: 7
Joined: Fri Oct 27, 2006 6:17 am

Post by TooCrooked »

i want users to be able to "own their results". this would allow them to sort their results in whatever ways i make possible, but they would see sorted results based on their original query, even if that query happened hours ago, and the database was just updated with 100% new data sometime after that.

so youre saying that SQL does not have the ability to create a "session of results" in any way or fashion?

?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Unless you do the sorting client side (with Javascript) or cache the results you are displaying to the user, no. Caching could simply involve a session data store.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

If you want this to be completely persistent, I think you're going to need to some data set identifier and just waste DB space creating a new data set for each time you update the DB.
TooCrooked
Forum Newbie
Posts: 7
Joined: Fri Oct 27, 2006 6:17 am

Post by TooCrooked »

im hopeful that i can use PHP's session variable to create the effect i want. thanks!
Post Reply