<?php 
class sostr{
  var $dbz;
  function sostr($str){
    $this->dbz=$str;
  }
  
  function sonum($sqls=''){
    $i=0;
	$sql=query("select id from ".$this->dbz."so ".$sqls." order by id asc");
	$i=rows($sql);
	return $i;
  }
  
  function solist($start,$num,$page,$sqls=''){
    $list='';
	
	$sql=query("select * from ".$this->dbz."so ".$sqls." order by counts desc limit ".$start.",".$num."");
	while($row=fetch($sql)){
	  if($row["hots"]==0){$hots="<a href=\"query.php?rel=so_hots&id=".$row["id"]."&num=1&page=$page\">热</a>";}else{$hots="<a href=\"query.php?rel=so_hots&id=".$row["id"]."&num=0&page=$page\"><font color=red>热</font></a>";}
	  
	  $list=$list."<tr align=\"center\">
	  <td  height=\"25\" bgcolor=\"#FFFFFF\">".$row["id"]."</td>
	  <td bgcolor=\"#FFFFFF\" align=\"left\"><a href=\"../so.php?keys=".urlencode($row["keywords"])."\" target=\"_blank\">".$row["keywords"]."</a></td>
	  <td bgcolor=\"#FFFFFF\" align=\"left\">$hots</td>
	  <td bgcolor=\"#FFFFFF\" align=\"left\">".$row["counts"]."</td>
	  <td bgcolor=\"#FFFFFF\" align=\"left\">".$row["times"]."</td>
	  <td bgcolor=\"#FFFFFF\" align=\"left\"> <a href=\"main.php?rel=so_info&id=".$row["id"]."&page=$page\">修改</a> <a href=\"query.php?rel=so_del&id=".$row["id"]."&page=$page\">删除</a></td>
	  ";
	  
	}
	
	return $list;
  } 
}
?>