Genesis Posted November 5, 2003 Share Posted November 5, 2003 Hi there, For my website I have a news system that will have thousands of entries. What I would like to do is retrieve the 10 most recent entries. Is there a \"get X most recent entries based on index\" function? I do NOT know how to use indexes, or autoincrements or anything like that. I have tried and tried to understand them, but no tutorial I\'ve seen yet has explained them in such a way that I can understand. Or, back to my first question: is there a way to concatenate two integers? I do NOT want them added.. just appending one onto the other, like a string. (I know about the concat() function, but I dunno if it works with integers..) The reason I need to do this is because if I cannot figure out indexes, I will have to concatenate the date with the time and use that as one big number to determine which 10 posts were made most recently. Any help is greatly appreciated Quote Link to comment https://forums.phpfreaks.com/topic/1301-concatenating-integers-with-mysql-or-get-last-10-entr/ Share on other sites More sharing options...
Derek Posted November 5, 2003 Share Posted November 5, 2003 Just add an id field to your news table, and give it an id field (make it the primary key, and make it AUTO_INCREMENT). then use this in your query: LIMIT 0,10 ORDER BY some_id_field DESC Quote Link to comment https://forums.phpfreaks.com/topic/1301-concatenating-integers-with-mysql-or-get-last-10-entr/#findComment-4322 Share on other sites More sharing options...
Genesis Posted November 5, 2003 Author Share Posted November 5, 2003 LOL.. all this struggling and it\'s that easy! Thanks a bunch!! Quote Link to comment https://forums.phpfreaks.com/topic/1301-concatenating-integers-with-mysql-or-get-last-10-entr/#findComment-4323 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.