Re: How to retrieve the position of a row inside a table with garbage data in all cloumns?

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

 



Trullo wrote:
On Tue, Sep 23, 2008 at 6:58 AM, Chris <dmagick@xxxxxxxxx> wrote:
To the OP: why does it matter where the row appears in the list?


In the case i'm facing it doesn't matter, but it could be useful to
display a scroll bar related to the size of the table and the row
viewed at the moment, or any simple [begin---youAreHere---end]
representation of the table.

Combine the prev & next queries to work out where you are.

$pages_before = select count(primary_key) from table where primary_key < $current_id;

$pages_after = select count(primary_key) from table where primary_key > $current_id;

Of course it will be an approximation only because as you are editing record #X someone else could be deleting records a,b,c...

--
Postgresql & php tutorials
http://www.designmagick.com/


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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux