Hi all,
Just wondering what you folks currently use to paginate the results from a mysql database query.
I am attempting to display data from a mysql database utilizing the code snippet "Prev 123 Next" snippet-ID "368" snippet-version "1.4".
http://www.phpbuilder.com/snippet/download.php?type=snippet&id=368
Running PHP 4.2.3 and mySQL 4.0.13 under IRIX 6.5.20.
A few edits to the script and it'll connect to my mysql server, select the desired database and table. That's fine.
An edit to the SELECT statement within the script will yield the display of the appropriate records.
All is well with 2 exceptions:
- The "paging" only actually works if I turn register_globals on in my php.ini file. This is ok at the moment, but after reading about the security implications regarding this, I'm not going to put my server online with register_globals turned on.
In the following example, register_globals is on.
- When I pass two variables to this script from a form, (a search word and sort order) via the use of a text field and radio button combination, I am presented the expected results sorted as desired, however upon clicking one of the links to obtain another page of results, my previously "form posted" variables vanish resulting in query failure and of course no results.
Is there a better way or script to handle the pagination of the search results than the one that I've chosen?
If not, can the chosen one be modified such as to happily co-exist with register_globals turned off?
Must I utilize a cookie to hold onto the variable that is vanishing or is there some other PHP way of doing this?
Simply put, I'm trying to search a mysql database from a html form and paginate the results back to the user's browser.
Sorry for the length, just trying to be thorough, I am new to PHP. Any pointers, links, etc. regarding these are greatly appreciated.
Thanks