Re: Clarification: Jump to a record/PHP paging...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 9:03 AM -0600 12/23/06, T.J. Mahaffey wrote:
I see now that I did not explain myself adequately.
I think "jump to record" was the wrong way to put it. So, here goes.

I already have excellent paging functionality working well, based on a nice tutorial at PHPFreaks.

My problem is that when a user performs a search, I need to display the page on which their search string is found, but still display ALL records within the paging of the entire database.
I've since discovered the core of what I need to do:

	1. I can find the record I need through a simple query.

2. I can easily determine WHICH page this record is on by counting BACKWARDS from the found record to the FIRST record, totaling the number of records from record 1 to the found record. Then, by performing a bit of division, I can determine which page that record appears on and direct the user to "...page=8" via $_GET.

SO, my question is: how might I have MySQL tell me how many records came BEFORE the found record? (FYI: there is currently no auto-incrementing ID on these records, so that obviously easy solution would be unavailable.)

Thanks in advance for any insight.

--
T.J. Mahaffey
tj@xxxxxxxxxxxxxx


tj:

In my opinion, wrong thinking. You ask how many records appear before and after a search string result. That's like asking "What's the difference between an orange?" -- it doesn't make sense.

The user enters a search string. All records are searched and the correct one is found and presented. Now you want the records that were not correct to be arranged in some manner of before and after correctness -- it doesn't make sense.

You could use a FULL TEXT search in order of relevance, much like what search engines do. But those searches come back with correct searches and then sort them in terms of relevance. They don't show the correct record and then all the records that were before and after correctness. Do you see what I mean?

You could put in a field that has a number assigned to it, and show what numbers came before and after the record selected (like sequence of entry, auto-incrementing ID ), but that isn't relevant to the original search criteria.

You need to think about what you specifically want to show the user -- what would make sense, or of use, to them?

hth's

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux