matthew798 Posted September 9, 2008 Share Posted September 9, 2008 Hey boys!! I have an admin panel, and i made it so that someone an login and post news. Everything works fine and dandy, but after about 20 news postings, the page gets pretty long... lol.. I have it set up like this: mysql_query("INSERT INTO news (`title`, `body`, `date`) VALUES ('Timmy Mellowman', '23', now())") or die(mysql_error()); It's all nice and formatted with html when it draws the info.. Only thing i want is to knwo if it's possible to take only say, 5 of the most recet database entries (i already have it set to sort by ID in a DESC order, so the news stories are in order). Basically, omit anything after it reaches 5 postings. Is there a way to do that? Link to comment https://forums.phpfreaks.com/topic/123462-truncating-whole-entries/ Share on other sites More sharing options...
vicodin Posted September 9, 2008 Share Posted September 9, 2008 make a loop with a counter that only goes up to 5. Link to comment https://forums.phpfreaks.com/topic/123462-truncating-whole-entries/#findComment-637644 Share on other sites More sharing options...
vicodin Posted September 9, 2008 Share Posted September 9, 2008 A move advanced thing you could do would be to add pagination... If you dont know what that is look up php pagination on google. Link to comment https://forums.phpfreaks.com/topic/123462-truncating-whole-entries/#findComment-637649 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.