So, I have a website for a database which contains biological data (proteins). In this website, there is a text search page,
where the user can specify one or more search terms in order to get data from the database. The user can enter up to 5 search terms in each of the
available text boxes, as shown below in text_search.php
The retrieve_text.php page gets the data submitted by the user and fetches the results. Also, if the user clicks on 1 or more of the
checkboxes next to each record, the respective entries are downloaded as raw format archives.
However, because in some cases there were more than 200 results
I decided to implement pagination... I searched around and asked for help, and managed to get it as far as you see below.
My problem is that, although the state of the selected entries is maintained as the user browses from page to page, this is NOT the
case for the $wclause_sql part, which is actually the "WHERE" clause of the sql query. So I can only see the first page, and not the others...
I used sessions in order to keep track which records are selected by the user, so as when the user finally hits 'Retrieve'
he can get all the desired entries, but I cannot transfer the $wclause and therefore, in all other pages except page 1, the SQL query is empty, thus no
entries are shown.
Notice only the value of the cursor (cs) change in each hyperlink href attribute and the number of the page 1, 2, 3.
Make sure the term1, ..., term5 are url encoded.
I assume in the retrieve_text.php you have two operations (functions):
- one that only determines the number of results when the request comes from text_search.php
- a second that retrieves only one page, according to the current value of the cursor
The reason being, you determine the number of results once when the new search terms are defines. Afterwards, you know how many pages of results that query has.