LIMIT $start, 10... how to pass last value queried into next page with GET??
Posted on
16th Feb 2014 07:03 pm by
admin
Ok I know how to display the first or last 10 results of a query...
$result = mysql_query("SELECT * FROM messages ORDER BY timemsg DESC LIMIT 10");
In a perfect world all the rows ID's would be in perfect order (i.e.- 10,9,8,7,6,5,4,3,2,1), so to display messages 30 to 40 I would just do LIMIT 30,10
but because of certain unforseen situations the actual results will end up being more like-
457
455
454
453
449
448
447
419
418
410
So I can display the last 10 results in descending order but then to show the "previous 10" results (using the above numbers for an example), I'm thinking I need to somehow
capture the last result in this query (410) so when you hit "previous 10" link it passes it through GET to the next page and the next page will use something like LIMIT $start,10
to display the 10 results with before "410" and so on. Any idea how to do this, I don't think it should be that hard, just can't figure it out. Sorry, if this is in wrong thread,
feel free to move to MYSQL board if it belongs there.. Thanks for any help!
No comments posted yet
Your Answer:
Login to answer
72
13
Other forums
Session variable help
I'm having a very troubling issue. Maybe I'm just looking over something but I have looked at the co
Need help with an email blocker for a guessbook
I am new with php and here is a simple guessbook page but I am being hit with spam from a group of t
PHP loop
Okay so I have several "articles" stored in a mysql database and am attempting to echo tho
displaying unknown amount of results
I am reading a directory and getting a list of folders in the directory, I want to display the folde
how do i display data on a page from mysql
1 - do i use this code at the top of each of my page i wish to only alow access if there as been a s
Program with calculate Meteorologic measurements
Hello I'm a beginner and I want to make a program with calculate Meteorologic measurements:
ba
HTML Viewer HIDE scrollbar
How can I disable scrollbars in a HTML Viewer control? I can't hide them. Even i have enough space b
check comment for html
hi, I just wanted to check if a comment a user posts contains HTML, and if it does, to not allow it
tag inside php... hi
Code: <?php echo "<td width="$columnWidth%" align=&include function being weird? I have a very simple system to grab an IP outputted by a PHP file.. (for a project I have) but it ou
|