$sql = "SELECT * FROM `shops` WHERE `subdomain` != '' ORDER BY RAND() LIMIT 100";
$rows = $db->getData($sql);
foreach($rows as $row)
{
echo '<li><a href="http://'.$row['subdomain'].'.baidu.com/" title="'.$row['title'].'">'.$row['title'].'</a></li>';
}
在文章页面需要获取随机文章做文章推荐,不知道怎么写,上面的对吗?
------解决方案--------------------
$sql = "SELECT * FROM (SELECT * FROM `shops` WHERE `subdomain` != '' ORDER BY RAND() LIMIT 100) t order by id desc";