gpt4 book ai didi

php - 使用 php 将 MySql 查询滚动到下一列。

转载 作者:行者123 更新时间:2023-11-30 01:02:39 24 4
gpt4 key购买 nike

我正在创建一个监视器显示,需要能够一次显示 16 个数字。一张表中有 8 个,下一张表中有 8 个。现在,我必须根据 MySql 数据库中的条目数不断向下移动表格。我需要的是每个表中 2 列(每列 4 个数字),并将它们限制为每个给定类别的最新 8 个数字。

这是我到目前为止所拥有的:一些帮助将不胜感激,我对此很困惑,谢谢。

    $select_query = "SELECT buyback.buyback_callNumber
FROM buyback WHERE buyback.buyback_status = 'In-Progress' ";
$select_query2 = "SELECT buyback.buyback_callNumber
FROM buyback WHERE buyback.buyback_status = 'Ready for Pickup'";

$result = mysql_query($select_query);



echo "
<align='center'>
<div class='span9' >
<table class='table table-striped table-bordered'>
<tr>
<td><strong><h3>In-Progress</h3></strong></td>
</tr>";
while($record = mysql_fetch_array($result)){
echo "<tr>";

echo "
<td><strong><h3>".$record['buyback_callNumber'] ."</h3></strong></td></tr>";

}
echo "</table></div>";

echo "
<div class='span9'>
<table class='table table-striped table-bordered'>
<tr>
<td><strong><h3>Ready</h3></strong></td>
</tr>";

$result2 = mysql_query($select_query2);
while($record2 = mysql_fetch_array($result2)){
echo "<tr>";

echo"
<td><strong><h3>".$record2['buyback_callNumber'] ."</h3></strong></td></tr>";

}
echo "</table></div></align>";



echo "</form> ";

最佳答案

至于将每个表的结果限制为 8 个,只需向每个查询添加“LIMIT 8”(您可能还想按日期或您可能设置的其他字段对这些查询进行排序)

$select_query = "SELECT buyback.buyback_callNumber
FROM buyback WHERE buyback.buyback_status = 'In-Progress' LIMIT 8";
$select_query2 = "SELECT buyback.buyback_callNumber
FROM buyback WHERE buyback.buyback_status = 'Ready for Pickup' LIMIT 8";

关于php - 使用 php 将 MySql 查询滚动到下一列。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19967733/

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