jbrill Posted August 15, 2007 Share Posted August 15, 2007 Hey guys, just wondering what i would add to the code below to only show the most recent entry. probably somethind like order by "startdate" and i would like it to only limit to one. thanks, <?php $result = mysql_query("SELECT * FROM news WHERE CURDATE() BETWEEN startdate AND expdate;"); while($row = mysql_fetch_array($result)) { echo "<p>" . $row['title'] . "</p>"; echo "<p class=\"SWhiteText\">" . substr($row['content'],0,500) . "</p>"; } ?> Link to comment https://forums.phpfreaks.com/topic/65141-what-would-i-add-to-this-code-to-make-it-show-only-the-most-recent-entry/ Share on other sites More sharing options...
BlueSkyIS Posted August 15, 2007 Share Posted August 15, 2007 SELECT * FROM news ORDER BY startdate DESC LIMIT 1 Link to comment https://forums.phpfreaks.com/topic/65141-what-would-i-add-to-this-code-to-make-it-show-only-the-most-recent-entry/#findComment-325141 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.