Closed Thread Icon

Topic awaiting preservation: PHP/mysql multi page issue (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=23986" title="Pages that link to Topic awaiting preservation: PHP/mysql multi page issue (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: PHP/mysql multi page issue <span class="small">(Page 1 of 1)</span>\

 
lallous
Maniac (V) Inmate

From: Lebanon
Insane since: May 2001

posted posted 11-10-2004 12:29

Hello

I wrote a simple script that lists records and allows multi page functionality using MySql's LIMIT syntax.

On that same page, I have a drop down that allows you to jump to a specific item given its ID.

Now I wonder, how I can determine what page does a given record w/ a given ID belongs to?!

In that way, I can directly jump to corresponding page given the item ID.

hope my inquiry was clear.

--
Regards,
Elias

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 11-10-2004 12:41

I removed your double posts.


You'll need to get "select count(id) from table where id < $givenID" to find out how many records are below the current one (provided you're sorting them by id!).
Then you can divide that by your records per page, and determine what page you need to go to.

so long,

->Tyberius Prime

lallous
Maniac (V) Inmate

From: Lebanon
Insane since: May 2001

posted posted 11-10-2004 13:44

thanks for removing the double posts (should I say tripple posts?!)...the connection went bad...

Yes, your idea sounds feasible.

Thanks

--
Regards,
Elias

« BackwardsOnwards »

Show Forum Drop Down Menu