How can i display only the last post from database? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can i display only the last post from database?

24th Jun 2018, 11:44 PM
Li2Ekodaf
Li2Ekodaf - avatar
5 Answers
+ 4
If your primary key for the specific entity is increasing, you can safely assume that the most recently added entry (or at least what I understand to be your "last entry") has the maximum key value. https://stackoverflow.com/questions/12626221/sql-query-to-find-max-primary-key-with-custom-format
25th Jun 2018, 1:46 AM
Hatsy Rei
Hatsy Rei - avatar
+ 1
Thanks! I mean i want to display the last row of my database. i.e I want the last entry of database to echo out in my favourite anytime i make a post.
24th Jun 2018, 11:53 PM
Li2Ekodaf
Li2Ekodaf - avatar
+ 1
wow! it worked. Thanks my friend, Wendy Seijas. Sololearn is really a solution center. Thanks to all who responded to my question.
25th Jun 2018, 2:49 PM
Li2Ekodaf
Li2Ekodaf - avatar
0
Yes of course
23rd Aug 2018, 1:53 PM
Li2Ekodaf
Li2Ekodaf - avatar
- 1
hi can you teach me?
23rd Jul 2018, 9:11 PM
A.K.A. !!!
A.K.A. !!! - avatar