How to retrieve the position of a row inside a table with garbage data in all cloumns?
| From: | Trullo | Date: | Tue, 23 Sep 2008 03:31:45 +0000 |
| Subject: | How to retrieve the position of a row inside a table with garbage data in all cloumns? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-45438@lists.php.net to get a copy of this message | ||
hello_world();
in fact.. how to goTo next/previous row of a table without using
incremental ids AND without reading the whole table?
i will explain:
I wanna do something like a paging toolbar blinded to a list of rows
(for example, a literally view of a db table).
The first difference from a normal paging system, is that i wanna show
only one row per page, and luckily i know the id of that first viewed
row; so, no problem until here. Im able to show the first row xD.
The second difference is that i don't know the position of the first
viewed row inside the whole original table, only the id of the row
(maybe someone is laughing while reading 'only').
I would like to know the position of that row to allow a easy goTo
next/prev method using LIMIT/OFFSET sql clauses.
But, since id's aren't incremental, and since i don't know the position
of that row, i cant find any way to know witch row is the next/prev.
I found a few solutions and it is poorly working now, reading the whole
table and thats all :o].
The front-end of the app, is not robust enough to fast-process this
amount of data (javascript), so this solution is a piece of ____.
I'm missing something?
How to retrieve the position of a row in a given table (always ordered
by ASC id) without reading more than one result per query using -only-
raw id's?
Thanks for your time.
Trullo :o]
P.S. Im using php526/mysql5051b but a generic answer is highly appreciated.