I am after an approach to solve a problem I have. I will be able to code it, I just need to know what to code!
Anyway. I Have a MySQL table with a number of records, that will probably not exceed a couple of thousand. Depending on which page the user browses, SQL is run, and it will display a table with a list of records that match the SQL. Up to this point I have no problem.
The table I display contains only parts of the record, and now, What I wish to do, is have links in this table to go to the record and show all details. Again, I can do this.
The part I now need help with is for example.
I query the database, and I get a resposnse and the matching records are 1, 4, 5, 6, 34, 67, 77, 87, 233, 456, 672, 890, 1002 etc.
From the table that displays this, the user clicks on reocrd 456, and all details of record 456 are displayed. for the purpose of this post, I will call this page "displayfullrecord.php"
On the displayfullrecord.php page, I wish to have a previous link to record 233 and a next link to record 672.
What is the best way to acheive this?
I must stress at this point, once the user has navigated to displayfullrecord.php, I then which to enable the user to navigate the records 1, 4, 5, 6, 34, 67, 77, 87, 233, 456, 672, 890, 1002 using only the next and previous links should they wish.
The only way I can think of doing this is to keep executing the SQL that produced the original table, and then selecting the next recocrd from the original match 1, 4, 5, 6, 34, 67, 77, 87, 233, 456, 672, 890, 1002.........
is there a better way of doing this?
to view these records, the user MUST be logged in anyway - so -
would it be sensible to store the original matches 1, 4, 5, 6, 34, 67, 77, 87, 233, 456, 672, 890, 1002 in an array, and make this array a session variable - then I can just navigate using this array? Would that be possible?
If someone can maybe give me any other possible approaches to this - that'd be great.
StevenJ