Rolando Edwards wrote:
I think you need this syntax
SELECT * FROM Clients ORDER BY Name LIMIT <offset>,<rows>

Your offset must be rows per page * pagenumber where minimum pagenumber is 0

You should also count the full result set
divide that count by the number of rows per page
to get the last page number
If the remainder is not zero, then add one to the max pagenumber


Yes!! But that's what I have already done and it is working :)

My problem is, when I go to the "find client" page and enter
a client name, and for example receive 14 results that match,
then I don't know what is the offset that I should use to
link to the page that displays the client info for each one
of those results...

Let me try to explain with an example:


Table Clients
=============

01 Ana Lucia
02 Mark David
03 George Carlin
04 Nelson Martin
05 Xavier Pitt
06 Martin Luther
07 Tony Andrew
08 Mark Donald
09 Petter James

When I'm navigating the clients page, I'm seeing all this ID's,
names, and a lot more information... In that page I have buttons
First 335 336 337 <338> 339 340 341 Last

I'm ordering by client name so my table looks like this

Table Clients
=============

01 Ana Lucia
03 George Carlin
02 Mark David
08 Mark Donald
06 Martin Luther
04 Nelson Martin
09 Petter James
07 Tony Andrew
05 Xavier Pitt

Each one of this buttons links to one of this pages, for example,
if a user clicks on 337 it links to href="clients.php?recID=337"

337 is not the ID of the client but the position of the client in
the table when ordered by client name.

When I search for a client "Mar" the WHERE will add a % and I will
query with WHERE Name LIKE 'Mar%'

This way I will retrieve the records

   Mark David
   Mark Donald
   Martin Luther

My problem/question is how can I know the link for each one of these
found records??? Which is the <offset> for the LIMIT???

In this case, by watching to the tables above I know that the limits
would be 3, 4 and 5 but how can I know this with php/MySQL code?

Thanks

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to