开发者

div box list generating SQL query, needs rearranging

开发者 https://www.devze.com 2023-03-26 19:56 出处:网络
So I am working on a logging system, that writes to a database. I am calling entries from a database to be written to this page:

So I am working on a logging system, that writes to a database. I am calling entries from a database to be written to this page:

www.benjaminpotter.org/elog/logbook.php

Now all is fi开发者_运维问答ne at the moment but the problem is that the nature of the SQL query I used to get these divs, and then the lists between them has set it so that I am looking at the earliest entry first.

For example, press the < button twice and you can see the most recent entry.

So I was wondering how I could start viewing them with the most recent entry first?

Here is the current sql I use:

SELECT * FROM logbook WHERE logId > '" . $lower . "' AND logId <= '" . $count . "' ORDER BY date DESC

Where "lower" is altered depending on the div being generated, and count represents the first id being placed in this div.

Hope that makes sense!


If you know the last id (I'll assume $lower is the last id) on the form, simply select a page full of records that are bigger then the last id.

SELECT * FROM logbook 
WHERE logId > '" . $lower . "' 
ORDER BY date DESC
LIMIT 10
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号