function link($num='')
{
global $db;
if($num=='')
{
$sql = "select `lid`,`webname`,`logo`,`url`,`describe` from `top_link` order by `lid`";
}
else
{
$sql = "select `lid`,`webname`,`logo`,`url`,`describe` from `top_link` order by `lid` limit 0,$num";
}
$query = $db->query($sql);
while($rs=$db->fetch_array($query))
{
if($rs[logo]=='')
{
echo"<li><a href=$rs[url] target='_blank' title='$rs[describe]'>$rs[webname]</a></li>";
}
else
{
echo"<a href=$rs[url] target='_blank' title='$rs[describe]'><img src='$rs[logo]' border='0'></a><br>";
}
}
}