mhodgson Posted November 26, 2007 Share Posted November 26, 2007 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. Quote Link to comment Share on other sites More sharing options...
trq Posted November 26, 2007 Share Posted November 26, 2007 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. Quote Link to comment Share on other sites More sharing options...
mhodgson Posted November 27, 2007 Author Share Posted November 27, 2007 My first hurdle was knowing if it could be done. Now I know it can be done I shall try some of the tutorials. If I get stuck I'll be back, as they say. Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.