php while循环问题

$sql1=mysql_query("select*fromtb_shangpin".$yijitype."".$erjitype."orderbyiddesclimit... $sql1=mysql_query("select * from tb_shangpin ".$yijitype." ".$erjitype." order by id desc limit ".($page-1)*$pagesize.",$pagesize",$conn);

<div id="pro1" style="display: none">
<?php while($info1=mysql_fetch_array($sql1)){?>
<div class=" foat_left showpro1" style=" border:0; "> <div class="showpic"><img src="../<?=$info1[tupian1];?>" width="114" height="120"></div> <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2" align="left" height="23"><strong><span class="STYLE10"><?php echo $info1[mingcheng];?></span></strong></td>
</tr>
<tr>
<td align="left"><span class="STYLE9"><?php echo $info1[shichangjia];?>元</span></td>
<td align="right">
<input type="checkbox" name="<?php echo $info1[id];?>" value="<?php echo $info1[id];?>" />选择 </td>
</tr>
</table>
</div>
<?php } ?>
</div>

<div id="pro2" style=" display: ">
<?php
while($info1=mysql_fetch_array($sql1))
{

?>
<div class="showpro2" style="clear:both">
<div style=" margin-right:11px;" class="showpic foat_left"><img src="../<?=$info1[tupian1];?>" width="114" height="120"></div>
<table width="541" border="0" cellspacing="0" cellpadding="0" style=" margin-top:44px">
<tr>
<td class="STYLE3"><strong>商品名称:</strong></td>
<td><strong>商品编码:</strong></td>
<td><strong>您的价格:</strong></td>
<td><strong class="STYLE6">建议零售:</strong></td>
<td><strong>上架时间:</strong></td>
<td><strong>更新时间:</strong></td>
<td><strong>浏览量:</strong></td>
<td> </td>
</tr>
<tr>
<td align="center" class="STYLE3"><strong><?php echo $info1[mingcheng];?></strong></td>
<td align="center"><strong><?php echo $info1[cpbm]; ?></strong></td>
<td align="center"><strong>*元</strong></td>
<td align="center" class="STYLE9"><strong><?php echo $info1[shichangjia ]; ?>元</strong></td>
<td align="center"><?php echo substr($info1[addtime],5); ?></td>
<td align="center"><?php echo substr($info1[newtime],5); ?></td>
<td align="center"><?php echo $info1[click]; ?></td>
<td><span class="STYLE9">选择</span>
<input type="checkbox" name="<?php echo $info1[id];?>" value="<?php echo $info1[id];?>" /></td>
</tr>
</table>

</div>
<?php
}

?>
</div>

问题是第二个循环没办法输出,上面的是代码片段,第一个循环是能正常输出,我希望两个循环都能正常输出,或有替代代码都可以
pro1是第一个循环,pro2是第二个循环,要求循环出来的数据都是一样
展开
 我来答
sunboatz
2009-08-26 · TA获得超过161个赞
知道小有建树答主
回答量:313
采纳率:100%
帮助的人:264万
展开全部
第二个 while($info1=mysql_fetch_array($sql1)) 里的sql1已经被你取到最后记录了,当然循环不出来了。
重新弄个 $sql = mysql_query("....");
然后再while
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
塑料做的铁钉
2009-08-26 · TA获得超过2259个赞
知道小有建树答主
回答量:989
采纳率:0%
帮助的人:1154万
展开全部
第一个while结束之后
第二个which开始之前
添加语句

mysql_data_seek($sql1,0);
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式