ryanwood4 Posted May 7, 2011 Share Posted May 7, 2011 I'm using the fairly simple below code to output a list of the latest articles, but I'm wanting (not sure if it's possible) to display the articles from the current day in bold so users recognise that they are new and the older ones non-bold. I've tried a few things, but they're not giving the desired results. <?php $con = mysql_connect("localhost","xxx","xxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("xxx", $con); $result = mysql_query("SELECT * FROM `articles` WHERE `quotes` NOT LIKE '%yes%' ORDER BY `date` DESC limit 0,14"); echo "<table class='links' border='0' width='100%'>"; while($row = mysql_fetch_array($result)) { echo '<tr><td width="270" valign="top"><h4>» <a href="news/display/'.$row['id'].'">'.$row['title'].'</a></td><td width="40" valign="top"><span class="small">'.date("M d", strtotime($row['date'])).'</span></h4></td></tr>'; } mysql_close($con); ?> Cheers! Link to comment https://forums.phpfreaks.com/topic/235803-displaying-current-articles-in-bold/ Share on other sites More sharing options...
fugix Posted May 7, 2011 Share Posted May 7, 2011 yeah you can compare the date for the atricles that are stored in the database to todays date using the NOW() function. then if the date is equal to todays date. wrap the text in <b></b> tags Link to comment https://forums.phpfreaks.com/topic/235803-displaying-current-articles-in-bold/#findComment-1212073 Share on other sites More sharing options...
ryanwood4 Posted May 7, 2011 Author Share Posted May 7, 2011 I tried that, unsuccessfully though, not quite sure how to implement it correctly. Any help would be much appreciated. Link to comment https://forums.phpfreaks.com/topic/235803-displaying-current-articles-in-bold/#findComment-1212076 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.