Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
「コメント」という名前のテーブルがあり、いくつかの列があります。ID, User, author, date, post
ID, User, author, date, post
私が望むのは、最新のコメントを上から順に、すべて垂直方向に最新の 10/20 のコメントを表示することです。
これはデータベース関連の質問です。通常、順序付けは SQL クエリ内で行われます。コメントテーブルが特定の構造を持っていると仮定すると、次のようになります。
SELECT ID, user, author, date, post FROM Comments ORDER BY date DESC LIMIT 0,10
limitmysqlクエリまたはjqueryのいずれかで機能しますprepend()。
limit
prepend()