$kkk = custom_tuijian("2008-08-15",date("年月日"));
//回显日期("Y-m-d");
//print_r($kkk);
function custom_tuijian($a,$b)
{
$sql = "选择 `r`.*,`a`.`文章名称`,`a`.`作者`
从 `phpsir_record1` `r` 内连接 `jieqi_article_article` `a`
在 `r`.`bookid` = `a`.`articleid` 上,其中 `r`.`rdate` = '$a' ";
$res = mysql_query($sql);
$sql2 = "从`phpsir_record1` `r`内连接`jieqi_article_article` `a`
中选择`r`.*,`a`.`文章名`,`a`.`作者`
在 `r`.`bookid` = `a`.`articleid` 上,其中 `r`.`rdate` = '$b' ";
$res2 = mysql_query($sql2);
while($row = mysql_fetch_assoc($res))
{
$row2 = mysql_fetch_assoc($res2);
$calnum = calnum($row,$row2);
$a_a[$row['bookid']] = $calnum;
$x[$row['bookid']] = array($row["articlename"],$row["author"],$row["bookid"]);
}
arsort($a_a);
foreach($a_a as $k=>$v)
{
$kk[] = array($x[$k][0],$x[$k][1 ],$x[$k][2],$v);
}
返回 $kk;
}
function calnum($r1,$r2)
{
//公式点击/100推荐*2收藏鲜花*10月票*10
return ($r2['clicknum' ] - $r1['clicknum']) / 100 ($r2['shoucangnum'] - $r1['shoucangnum'])
($r2['xianhuanum'] - $r1['xianhuanum']) * 10 ($r2['月票'] - $r1['月票']) * 10 ;
}
//数据调用方法
for($ii=0; $ii $bookid=$kkk[$ii][2];
$ml=floor($bookid/1000);
echo "".$kkk[$ii][0]."";
}