我有一个重复的地区问题。我在这里尝试做的是从查询中重复信息,直到它用完为止。我有限制设置为5.我希望重复信息,但重复时DIV ID会发生变化。这是可能吗?我想在这里创建的是一个特色的jquery滑块,为此我需要显示的内容,当它滑过或点击时将这些拉到主盒中。提前致谢。
<?php
$idname = "fragment-";
$idnum = 1;
echo $idname . $idnum;
?>
<?php do { ?>
<div id="<?php for($idnum=1;$idnum<=5;$idnum++){
echo $idname . $idnum++; break;}?>" class="ui-tabs-panel" style="">
<img src="<?php echo $row_getDisplay['picture']; ?>" alt="" />
<div class="info" >
<h2><a href="fetch?id=<?php echo $row_getDisplay['post_id']; ?>" ><?php echo $row_getDisplay['title']; ?></a></h2>
<p><?php echo $row_getDisplay['preview']; ?><a href="fetch?id=<?php echo $row_getDisplay['post_id']; ?>" >Click Here</a></p> </div>
</div>
<?php } while ($row_getDisplay = mysql_fetch_assoc($getDisplay)); ?>
这是代码的当前输出..
<div id="fragment-1" class="ui-tabs-panel" style="">
<img src="images/archives/2012/july/1343579505.jpg" alt="" />
<div class="info" >
<h2><a href="fetch?id=39" >Testing Preview Box Character Count max out on the total number</a></h2>
<p>Other things have to go here to show the preview seems like other things don't really fit<a href="fetch?id=39" >Click Here</a></p> </div>
</div>
答案 0 :(得分:0)
<?php
$idnum = 1;
do { ?>
<div id="fragment-<?php echo $idnum; ?>" class="ui-tabs-panel" style="">
<?php $idnum++; ?>
<img src="<?php echo $row_getDisplay['picture']; ?>" alt="" />
<div class="info" >
<h2><a href="fetch?id=<?php echo $row_getDisplay['post_id']; ?>" ><?php echo $row_getDisplay['title']; ?></a></h2>
<p><?php echo $row_getDisplay['preview']; ?><a href="fetch?id=<?php echo $row_getDisplay['post_id']; ?>" >Click Here</a></p>
</div>
</div>
<?php } while ($row_getDisplay = mysql_fetch_assoc($getDisplay)); ?>