ryanwood4 Posted October 15, 2009 Share Posted October 15, 2009 I'm using the below code to fetch the most recent 24 articles stored in the database. However, I need to change it, so it only fetches posts from the current day. So for example, today it would fetch the 15th October 2009 results, and tomorrow the 16th's. Is this possible? <?php $con = mysql_connect("xxxx","xxxx","xxxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("xxxx", $con); $result = mysql_query("SELECT * FROM n2s_article ORDER BY article_id DESC LIMIT 0,23"); echo "<table class='links' border='0'> <tr> <th></th> </tr>"; while($row = mysql_fetch_array($result)) { $url = $row['article_url'] . "-" . $row['article_id'] . ".html"; echo "<tr>"; echo "<td class='link'><font face='verdana' size='1pt'>» <a href='$url'>".stripslashes($row['article_title'])."</a></td>"; } mysql_close($con); ?>[/code Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/177830-fetching-data-using-specific-dates/ Share on other sites More sharing options...
SchweppesAle Posted October 16, 2009 Share Posted October 16, 2009 what's the structure of the "n2s_article" table. Quote Link to comment https://forums.phpfreaks.com/topic/177830-fetching-data-using-specific-dates/#findComment-937821 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.