原代码如下: $catsql="select * from nov_cat order by id";
$catres=@mysql_query($catsql);
for ($i=0;$i<@mysql_num_rows($catres);) {
$catle.="<table width=\"960\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
$catle.="<tr>\n";
<1>for ($k=0;$k<3;$k++) {
if ($i>=@mysql_num_rows($catres)){break;}
$booksql="select * from nov_books where catid=".@mysql_result($catres,$i,"id")." order by id desc";
$bookres=@mysql_query($booksql); //if (@mysql_num_rows($bookres)==0)continue;
请这个地方,我怎么也不行啊!
说明:当@mysql_num_rows($bookres)等于"0"的时候就跳过<1>本次循环,进入<1>的下一个循环中
$catle.="<!--".@mysql_result($catres,$i,"tittle")."分类开始-->\n";
$catle.="<td width=\"320\">\n";
$catle.="<table width=\"99%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"main\">\n";
$catle.="<tr>\n";
$catle.="<td>\n";
$catle.="<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
$catle.="<tr>\n";
$catle.="<td class=\"title1\" colspan=\"2\">".@mysql_result($catres,$i,"tittle")."</td>\n";
$catle.="</td>\n";
$catle.="</tr>\n";
$catle.="<tr>\n";
$catle.="<td width=\"100\" height=\"125\" rowspan=\"2\" class=\"titletu\">";
$catle.="<img width=\"100\" height=\"125\" src=".@mysql_result($bookres,0,"images").">";
$catle.="</td>\n";
$catle.="<td class=\"title5\"> 《".@mysql_result($bookres,0,"tittle")."》</td>\n";
$catle.="</tr>\n";
$catle.="<tr>\n";
$catle.="<td height=\"103\" class=\"title11\">";
if (strlen(@mysql_result($bookres,0,"description"))>260) {
$catle.=substr(@mysql_result($bookres,0,"description"),0,250);
}else{
$catle.=@mysql_result($bookres,0,"description");
}
$catle.="...</td>\n";
$catle.="</tr>\n";
$catle.="</table>\n";
$catle.="</td>\n";
$catle.="</tr>\n";
for ($b=1;$b<11;$b++) {
if ($b>=@mysql_num_rows($bookres)){break;}
$catle.="<tr>\n";
$catle.="<td>《".@mysql_result($bookres,$b,"tittle")."》</td>\n";
$catle.="</tr>\n";
}
$catle.="</table>\n";
$catle.="</td>\n";
$catle.="<!--".@mysql_result($catres,$i,"tittle")."分类结束-->\n\n";
$i++;
}
$catle.="</tr>\n";
$catle.="</table>\n";
$catle.="<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
$catle.="<tr>\n";
$catle.="<td height=5>\n";
$catle.="</td>\n";
$catle.="</tr>\n";
$catle.="</table>\n";
}
echo $catle;
$catres=@mysql_query($catsql);
for ($i=0;$i<@mysql_num_rows($catres);) {
$catle.="<table width=\"960\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
$catle.="<tr>\n";
<1>for ($k=0;$k<3;$k++) {
if ($i>=@mysql_num_rows($catres)){break;}
$booksql="select * from nov_books where catid=".@mysql_result($catres,$i,"id")." order by id desc";
$bookres=@mysql_query($booksql); //if (@mysql_num_rows($bookres)==0)continue;
请这个地方,我怎么也不行啊!
说明:当@mysql_num_rows($bookres)等于"0"的时候就跳过<1>本次循环,进入<1>的下一个循环中
$catle.="<!--".@mysql_result($catres,$i,"tittle")."分类开始-->\n";
$catle.="<td width=\"320\">\n";
$catle.="<table width=\"99%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"main\">\n";
$catle.="<tr>\n";
$catle.="<td>\n";
$catle.="<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
$catle.="<tr>\n";
$catle.="<td class=\"title1\" colspan=\"2\">".@mysql_result($catres,$i,"tittle")."</td>\n";
$catle.="</td>\n";
$catle.="</tr>\n";
$catle.="<tr>\n";
$catle.="<td width=\"100\" height=\"125\" rowspan=\"2\" class=\"titletu\">";
$catle.="<img width=\"100\" height=\"125\" src=".@mysql_result($bookres,0,"images").">";
$catle.="</td>\n";
$catle.="<td class=\"title5\"> 《".@mysql_result($bookres,0,"tittle")."》</td>\n";
$catle.="</tr>\n";
$catle.="<tr>\n";
$catle.="<td height=\"103\" class=\"title11\">";
if (strlen(@mysql_result($bookres,0,"description"))>260) {
$catle.=substr(@mysql_result($bookres,0,"description"),0,250);
}else{
$catle.=@mysql_result($bookres,0,"description");
}
$catle.="...</td>\n";
$catle.="</tr>\n";
$catle.="</table>\n";
$catle.="</td>\n";
$catle.="</tr>\n";
for ($b=1;$b<11;$b++) {
if ($b>=@mysql_num_rows($bookres)){break;}
$catle.="<tr>\n";
$catle.="<td>《".@mysql_result($bookres,$b,"tittle")."》</td>\n";
$catle.="</tr>\n";
}
$catle.="</table>\n";
$catle.="</td>\n";
$catle.="<!--".@mysql_result($catres,$i,"tittle")."分类结束-->\n\n";
$i++;
}
$catle.="</tr>\n";
$catle.="</table>\n";
$catle.="<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
$catle.="<tr>\n";
$catle.="<td height=5>\n";
$catle.="</td>\n";
$catle.="</tr>\n";
$catle.="</table>\n";
}
echo $catle;
解决方案 »
- 请教2个问题:php的imagecreatefromjpeg和一个ajax
- 关于PHP配置完后,启动apache不成功的问题
- mail()函数返回SMTP server response: 554 Remote Return: 503 5.5.2 Need Rcpt command
- 跪求高手解决个小问题。。。。帮帮忙吧。。。
- php+xml 问题,在线等
- 关于离职
- ubuntu系统,在终端命令行调试PHP程序,有什么软件?
- apache2.0.55能访问localhost/web/但不允许访问localhost/web/manager是怎么回事啊?
- JS中调用PHP函数的问题
- 如何在局域网设置[mail function]中的SMTP.
- 强烈推荐台湾中原大学的php教程。 诙谐幽默,那绝对是大陆的教程没法比的
- 广州招聘PHP程序员
if ($i>=@mysql_num_rows($catres)){break 0;}