<?php
        $no=0;
        $cx=$empire->query("SELECT classid, title ,titleurl, productpic FROM hd_ecms_shop WHERE hd_ecms_shop.id=$bqrd[id]");
            while($bqrf=$empire->fetch($cx)) {
       ?>
            <div class="ptpro<?=$no?>"><a href="<?=$bqrf['titleurl']?>"><img src="<?=$bqrf['productpic']?>" border="0" width="325" height="237" /></a></div>
        <?php
        $no++;
        }
        ?>
<?php
}
?> 
上面这段代码前面的一些句子,省略了,没写,这段代码是有值的,通过print_r能打印出数组来,这个请你放心.
现在的问题是总共打印出五个数组来了,我现在需要变样式,所以加了一个no记数变量.但是,这么写输出来的no值只有一个数0
不知为啥,按说我写了$no++了,应该每循环一次增加一个数才对哈,不知哪里错了,

解决方案 »

  1.   

      <div class="ptpro<?=$no?>"><a href="<?=$bqrf['titleurl']?>"><img src="<?=$bqrf['productpic']?>" border="0" width="325" height="237" /></a></div>这里输出是否是多个值
      

  2.   

      <div class="ptpro<?=$no?>"><a href="<?=$bqrf['titleurl']?>"><img src="<?=$bqrf['productpic']?>" border="0" width="325" height="237" /></a></div>这一段有输出?输出了几次
      

  3.   

    while条件的查询是否有值,是不是没有执行到$no++的while条件里