tj Posted April 25, 2007 Share Posted April 25, 2007 Hi guys, Was wondering if anyone could help me modify the following: <?php include("support/configuration.php"); include("support/includes/functions.php"); $link = mysql_connect($db_host,$db_username,$db_password); mysql_select_db($db_name); $query = "SELECT * FROM tblannouncements WHERE published='on' ORDER BY date DESC"; $result=mysql_query($query); while($data = mysql_fetch_array($result)) { $id = $data["id"]; $date = $data["date"]; $title = $data["title"]; $announcement = $data["announcement"]; $date = fromMySQLDate($date); echo(" <font color=#cccccc>$date</font> - [b]$title[/b] $announcement</p>"); } ?> To only display the last 3 announcements published? Thanks 0 Quote Link to comment Share on other sites More sharing options...
Adam Posted April 26, 2007 Share Posted April 26, 2007 Hey, Try the following, <?php include("support/configuration.php"); include("support/includes/functions.php"); $link = mysql_connect($db_host,$db_username,$db_password); mysql_select_db($db_name); $query = "SELECT * FROM tblannouncements WHERE published='on' ORDER BY date DESC LIMIT 0, 3"; $result=mysql_query($query); while($data = mysql_fetch_array($result)) { $id = $data["id"]; $date = $data["date"]; $title = $data["title"]; $announcement = $data["announcement"]; $date = fromMySQLDate($date); echo(" <font color=#cccccc>$date</font> - [b]$title[/b] $announcement</p>"); } ?> From, Adam 0 Quote Link to comment Share on other sites More sharing options...
FavHost Posted August 7, 2007 Share Posted August 7, 2007 Awsome Adam! How would i go about changing it to just the last 30 or 60 days? 0 Quote Link to comment 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.