Example:
[php]
CREATE TABLE notifications
(
ID
int(11) NOT NULL AUTO_INCREMENT,
Title
varchar(255) DEFAULT NULL,
Description
varchar(255) DEFAULT NULL,
Status
varchar(255) DEFAULT NULL,
PRIMARY KEY (ID
)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;
insert into test.notifications
(Title, Description, Status
)
values
(‘test2’, ‘desc2’, ‘active’),
(‘test3’, ‘desc3’, ‘active’),
(‘test4’, ‘desc4’, ‘active’),
(‘test5’, ‘desc5’, ‘active’),
(‘test6’, ‘desc6’, ‘active’),
(‘test7’, ‘desc7’, ‘active’),
(‘test8’, ‘desc8’, ‘active’),
(‘test9’, ‘desc9’, ‘active’),
(‘test10’, ‘desc10’, ‘active’);
SELECT * FROM test.notifications order by ID desc limit 8;
[/php]
Returns:
[php]
10 test10 desc10 active
9 test9 desc9 active
8 test8 desc8 active
7 test7 desc7 active
6 test6 desc6 active
5 test5 desc5 active
4 test4 desc4 active
3 test3 desc3 active
[/php]