$sql2="select * from phome_ecms_zb where classid=89 and to_days(bssj)=to_days(now())+1 and checked=1 order by bssj limit 0,5";
把红色部分去掉!
while循环的时候加上: while($r2=mysql_fetch_array($result2))
{
$count+=count($array[‘[color=#FF0000]classid’]);[/color]//计算classid的号数
if($count>87)//当classid号得到要提取的时候,输出相关信息
{
$titleurl2=sys_ReturnBqTitleLink($r2);
//输出第一栏
if(mysql_num_rows($result2)>0)
{
if($is89!=1)
{
//输出标题栏
echo "<div class='b_r_bottom'><div class='b_r_b_top'><ul><li class='b_r_b_top1'><img src='/index/slive_tu.JPG' /></li><li class='b_r_b_top2'> Baseball </li><li class='b_r_b_top1'><img src='/index/slive_tu1.JPG' /></li><li class='b_r_b_top3'> 1 x 2</li></ul></div><div class='b_r_b_bottom'>";
$is89=1;
}
echo "<ul><li class='b_r_b_bottom2'><span style='float:right;'>";
if($_COOKIE["szsq"]==null||$_COOKIE["szsq"]==""||($_COOKIE["szsq"]<-12)||($_COOKIE["szsq"]>13))
{
echo gmdate("m-d H:i",date("U",strtotime($r2[38]))+(60*60*(-7)));
}
else
{
echo gmdate("m-d H:i",date("U",strtotime($r2[38]))+(60*60*(($_COOKIE["szsq"]))));
}
echo"</span> <a href='".$titleurl2."' target='_blank'>$r2[41]</a></li><li class='b_r_b_bottom3'>$r2[47]</li><li class='b_r_b_bottom3'>$r2[48]</li><li class='b_r_b_bottom3'>$r2[50]</li><li class='b_r_b_bottom4'><img src='/index/slive_tu2.GIF' width='34' height='23' /></li></ul>";
}//直播if结束
}//if结束
} //while结束
把红色部分去掉!
while循环的时候加上: while($r2=mysql_fetch_array($result2))
{
$count+=count($array[‘[color=#FF0000]classid’]);[/color]//计算classid的号数
if($count>87)//当classid号得到要提取的时候,输出相关信息
{
$titleurl2=sys_ReturnBqTitleLink($r2);
//输出第一栏
if(mysql_num_rows($result2)>0)
{
if($is89!=1)
{
//输出标题栏
echo "<div class='b_r_bottom'><div class='b_r_b_top'><ul><li class='b_r_b_top1'><img src='/index/slive_tu.JPG' /></li><li class='b_r_b_top2'> Baseball </li><li class='b_r_b_top1'><img src='/index/slive_tu1.JPG' /></li><li class='b_r_b_top3'> 1 x 2</li></ul></div><div class='b_r_b_bottom'>";
$is89=1;
}
echo "<ul><li class='b_r_b_bottom2'><span style='float:right;'>";
if($_COOKIE["szsq"]==null||$_COOKIE["szsq"]==""||($_COOKIE["szsq"]<-12)||($_COOKIE["szsq"]>13))
{
echo gmdate("m-d H:i",date("U",strtotime($r2[38]))+(60*60*(-7)));
}
else
{
echo gmdate("m-d H:i",date("U",strtotime($r2[38]))+(60*60*(($_COOKIE["szsq"]))));
}
echo"</span> <a href='".$titleurl2."' target='_blank'>$r2[41]</a></li><li class='b_r_b_bottom3'>$r2[47]</li><li class='b_r_b_bottom3'>$r2[48]</li><li class='b_r_b_bottom3'>$r2[50]</li><li class='b_r_b_bottom4'><img src='/index/slive_tu2.GIF' width='34' height='23' /></li></ul>";
}//直播if结束
}//if结束
} //while结束
减少循环里的if语句.
$sql="select * from phome_ecms_zb where classid=88 and to_days(bssj)=to_days(now())+1 and checked=1 order by bssj limit 0,5 union select * from phome_ecms_zb where classid=89 and to_days(bssj)=to_days(now())+1 and checked=1 order by bssj limit 0,5";放在while里面这样的if(mysql_num_rows($result1)>0)就不用写了。肯定有值的。
//连接数据库
$conn=mysql_connect("127.0.0.1","root","123456");
mysql_query("set names utf-8");
//id=88开始
//查询
$sql1="select * from phome_ecms_zb where classid=88 and to_days(bssj)=to_days(now())+1 and checked=1 order by bssj limit 0,5 union
select * from phome_ecms_zb where classid=89 and to_days(bssj)=to_days(now())+1 and checked=1 order by bssj limit 0,5";
//执行语句
$result1=mysql_db_query ("empirecms1",$sql1,$conn) or die (mysql_error());
while($r1=mysql_fetch_array($result1))
{
$titleurl1=sys_ReturnBqTitleLink($r1);
//输出第一栏
if($tempid!=$rs['classid']){//输出标题栏
if(!empty($tempid)){echo "</div></div>";};
echo "<div class='b_r_bottom'><div class='b_r_b_top'><ul><li class='b_r_b_top1'><img src='/index/slive_tu.JPG' /></li><li class='b_r_b_top2'> Am. Football </li><li class='b_r_b_top1'><img src='/index/slive_tu1.JPG' /></li><li class='b_r_b_top3'> 1 x 2</li></ul></div><div class='b_r_b_bottom'>";
}
echo "<ul><li class='b_r_b_bottom2'><span style='float:right;'>";
if($_COOKIE["szsq"]==null||$_COOKIE["szsq"]==""||($_COOKIE["szsq"]<-12)||($_COOKIE["szsq"]>13)){
echo gmdate("m-d H:i",date("U",strtotime($r1[38]))+(60*60*(-7)));
}else{
echo gmdate("m-d H:i",date("U",strtotime($r1[38]))+(60*60*(($_COOKIE["szsq"]))));
}
echo"</span> <a href='".$titleurl1."' target='_blank'>$r1[41]</a></li><li class='b_r_b_bottom3'>$r1[47]</li><li class='b_r_b_bottom3'>$r1[48]</li><li class='b_r_b_bottom3'>$r1[50]</li><li class='b_r_b_bottom4'><img src='/index/slive_tu2.GIF' width='34' height='23' /></li></ul>";
$tempid=$rs['classid'];
} //while结束
if(mysql_num_rows($result1)>0)
{
echo "</div></div>";
}
合并SQL语句写的,试试看能用不.