SQL里desc和asc的意思
desc是descend 降序意思
asc 是ascend 升序意思
sql = "select 表内容名逗号分割 from 数据库表名 Putout=true order by 读取的排序表名 asc"
例如
sql = "select ,ID,name,time from user Putout=true order by time desc" '按最新时间来排序
sql = "select ,ID,name,time from user Putout=true order by time asc" '按早时间来排序
'这里by time desc是排序或者用ID来判断,desc为倒序 asc为正序
例子:
<?php
$qydt_list = array();
$query = $db->query(sprintf("SELECT title FROM %s ORDER BY id asc LIMIT 0,5 ", $TABLE_HOME));
if ($query)
{
while ($zjfy = $db->fetch_array($query))
{
$qydt_list[] = $zjfy;
}
}
foreach ($qydt_list as $zjfy_item)
{
?>
<tr>
<td height="23"> <span class="style4">·<a href="、"><?=substrs($zjfy_item['title'],58)?></a></span></td>
</tr>
<?php
}
?>