<?php
$sql=mysql_query("SELECT description FROM `tbl_news` where `flag`=1 and `show_at`='notice_board'");
if(mysql_num_rows($sql)>0)
{
$i=1;
while($row=mysql_fetch_array($sql))
{
?>
<br/>
<img src="images1/left_nav_symbol.png" alt="" />
<font color="#000000">
<?php echo $row['description'];?> <img src="images1/new1.GIF" alt=""/>
</font>
<?php
$i=$i+1;
}
}
else
{
echo "No records found.";
}
This is my code. I want to fetch values of column description
by the latest value, show it by highlighting or set a new button image to it. Is there any solution for it?
要获取最新值,可以使用MAX
MAX(description) in select query
The table should have an auto_increment
ID or a datetime field (maybe with the default value NOW()
), indicating when the rows were inserted.
Using this field you can order the results of the query like:
SELECT description FROM `tbl_news` where `flag`=1 and `show_at`='notice_board' ORDER BY `stored_at` DESC
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.