Jump to content

Session question


mhodgson

Recommended Posts

I'm not fully conversent with sessions and I suspect they are the answer to this problem but I cannot figure this one out yet.

 

I have a table with data drawn from a database and some calculated on the page.

e.g.

 

1 Name | Score 1 |Score 2 | Average Score  where average score is calculated on the page.

2 Name | Score 1 |Score 2 | Average Score

3 Name | Score 1 |Score 2 | Average Score

4 Name | Score 1 |Score 2 | Average Score

etc.

 

Can I carry this data to a new page without having to call from the database again.

The reason is that I want to sort ALL the columns (which I can do already) but then transfer that sorted table to a new page for printing.

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/78917-session-question/
Share on other sites

Can I carry this data to a new page without having to call from the database again.

 

Yes. There are however plenty of tutorials around explaining the use of sessions, do we really need to write another here?

 

All you need do is start a session using session_start, then save your values into the $_SESSION array (it works just like any other associative array), then on the page you wish to retrieve the data back from the $_SESSION array, you need to call session_start again, then grap your data from the $_SESSION array.

 

The main thing to remember is ALL pages using the $_SESSION array need a call to session_start.

Link to comment
https://forums.phpfreaks.com/topic/78917-session-question/#findComment-399376
Share on other sites

Archived

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

×
×
  • Create New...

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.