gpt4 book ai didi

php - 分页打印数据自动递增

转载 作者:行者123 更新时间:2023-11-29 12:50:56 24 4
gpt4 key购买 nike

我知道这是一个愚蠢的问题,但这给我带来了问题......我想通过自动增量从 mysql 打印数据,但是当我使用下面的代码时,它会自动增量同一页面中的值,但我希望它也继续到下一页,这是我的代码

<?php
$perpage = 10;
$start = (isset($_GET['id'])) ? $_GET['id'] : 0;
$TotalRec = mysql_result(mysql_query("SELECT COUNT(*) FROM register where
r_bid='".$_SESSION["id"]."'"), 0);
$select = "SELECT * FROM register where r_bid='".$_SESSION["id"]."' LIMIT
$start,$perpage";
$result = mysql_query($select) or die(mysql_error());
$res = mysql_query("select * from regi_balic where b_id='".$_SESSION["id"]."'");
$row1=mysql_fetch_array($res);
$i=1;
while($row = mysql_fetch_array($result))
{
echo '<tr>
<td align="center" width=5%><font size=3>'.$i.'</font></td>
<td width=12%><font size=3>'.$row1['name'].'</font></td>
<td align="center" width=5%><font size=3><a href="edit_detail.phpid='.$row["r_id"].'
&cand_id='.$_SESSION["id"].'&email='.$row["email"].'">'.$row['name'].'</a></font></td>
<td align="center" width=5%><font size=3>'.$row['reference'].'</font></td>
<td align="right" style="padding-right:8px" width=12%>
<fontsize=3>'.$row['age'].'</font></td>
<td align="right" style="padding-right:8px" width=12%>
<fontsize=3>'.$row['occupation'].'</font></td>
<td width=12%><font size=3>'.$row['mob_no'].'</font></td>
<td width=2%><a href="process_del_client.php?id='.$row['r_id'].'"
onClick="returnConfirmSubmit(\'Are You sure ?\')"><img src = "images/delete.png">
</a></td>
</tr>';
}
$i++;
echo '</table>';
if($start == 0)
{
echo "<br>Previous Page&nbsp;";
}
else
{
echo '<br><a href='."./view.php?id=" . ($start - $perpage) . '>'.
"PreviousPage".'</a>&nbsp;';
}
if($start + $perpage >= $TotalRec)
{
echo "&nbsp;Next Page<br>";
}
else
{
echo '&nbsp;<a href='."./view.php?id=" . ($start + $perpage) . '>'."Next Page".'
</a><br>';
}
?>

最佳答案

更新 session 变量中的值并将其用于另一个页面进行更新。例如..

$_SESSION['值']=0$_SESSION['值']=$_SESSION['值']++;

关于php - 分页打印数据自动递增,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24734028/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com