doukuanghuan7582 2018-08-01 02:18
浏览 40
已采纳

如何从另一个表创建我的PHP表

I have a table on my website with following codethis is the table image

code for this table

<?php
    $query = $db->query("SELECT * FROM bit_exchanges ORDER BY id DESC LIMIT 20"); 
    if($query->num_rows>0) {
        while($row = $query->fetch_assoc()) {
?>
            <tr>
                <td id="tabletext"><img src="<?php echo gatewayicon(gatewayinfo($row['gateway_send'],"name")); ?>" width="20px" height="20"> <?php echo gatewayinfo($row['gateway_send'],"name"); ?></td>
                <td id="tabletext"><img src="<?php echo gatewayicon(gatewayinfo($row['gateway_receive'],"name")); ?>" width="20px" height="20"> <?php echo gatewayinfo($row['gateway_receive'],"name"); ?></td>
                <td id="tabletext"><?php echo $row['amount_send']; ?> <?php echo gatewayinfo($row['gateway_send'],"currency"); ?></td>
                <td id="tabletext"><?php echo cropexchangeid($row['exchange_id'],8); ?></td>
                <td id="tabletext">
                <?php 
                    if($row['status'] == "1") {
                        echo '<span class="label label-warning"><i class="fa fa-clock-o"></i> '.$lang[status_1].'</span>';
                    } elseif($row['status'] == "2") {
                        echo '<span class="label label-warning"><i class="fa fa-clock-o"></i> '.$lang[status_2].'</span>';
                    } elseif($row['status'] == "3") {
                        echo '<span class="label label-info"><i class="fa fa-clock-o"></i> '.$lang[status_3].'</span>';
                    } elseif($row['status'] == "4") {
                        echo '<span class="label label-success"><i class="fa fa-check"></i> '.$lang[status_4].'</span>';
                    } elseif($row['status'] == "5") {
                        echo '<span class="label label-danger"><i class="fa fa-times"></i> '.$lang[status_5].'</span>';
                    } elseif($row['status'] == "6") {
                        echo '<span class="label label-danger"><i class="fa fa-times"></i> '.$lang[status_6].'</span>';
                    } elseif($row['status'] == "7") {
                        echo '<span class="label label-danger"><i class="fa fa-times"></i> '.$lang[status_7].'</span>';
                    } else {
                        echo '<span class="label label-default">'.$lang[status_unknown].'</span>';
                    }
                ?>
                </td>
                <td id="tabletext"><?php echo date("d/m/Y",$row['created']) ?></td>
            </tr>
<?php
        }
    } else {
        echo '<tr><td colspan="5">'.$lang[still_no_exchanges].'</td></tr>';
    }
?>

I just want to make a new table bottom this current table with my selected row which are only "processed"

I just want this rows into my new table see this image When "processing" status will processed, It will be automatically will go into new table. Please help me to create this query.

This is my Database image , my database image I just want entire table rows which are "4" Please help.

</div>
  • 写回答

1条回答 默认 最新

  • dongna9185 2018-08-01 04:12
    关注

    This might sound a bit simple, but why don't you just change the first db-query to:

    "SELECT * FROM bit_exchanges WHERE status <> 4 ORDER BY id DESC LIMIT X"
    

    You then won't get rows where status is 4. Then proceed making a new table similar to the one you made with the query

    "SELECT * FROM bit_exchanges WHERE status=4 ORDER BY id DESC LIMIT X"
    

    You can then remove the elseif checking ( elseif($row['status'] == "4" ).

    Your second table-code would look like this:

    <?php
        $query = $db->query("SELECT * FROM bit_exchanges WHERE status=4 ORDER BY id DESC LIMIT X"); 
        if($query->num_rows>0) {
            while($row = $query->fetch_assoc()) {
    ?>
                <tr>
                    <td id="tabletext"><img src="<?php echo gatewayicon(gatewayinfo($row['gateway_send'],"name")); ?>" width="20px" height="20"> <?php echo gatewayinfo($row['gateway_send'],"name"); ?></td>
                    <td id="tabletext"><img src="<?php echo gatewayicon(gatewayinfo($row['gateway_receive'],"name")); ?>" width="20px" height="20"> <?php echo gatewayinfo($row['gateway_receive'],"name"); ?></td>
                    <td id="tabletext"><?php echo $row['amount_send']; ?> <?php echo gatewayinfo($row['gateway_send'],"currency"); ?></td>
                    <td id="tabletext"><?php echo cropexchangeid($row['exchange_id'],8); ?></td>
                    <td id="tabletext">
                    <?php 
                            echo '<span class="label label-success"><i class="fa fa-check"></i> '.$lang[status_4].'</span>';
                    ?>
                    </td>
                    <td id="tabletext"><?php echo date("d/m/Y",$row['created']) ?></td>
                </tr>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序
  • ¥15 onvif+openssl,vs2022编译openssl64
  • ¥15 iOS 自定义输入法-第三方输入法
  • ¥15 很想要一个很好的答案或提示
  • ¥15 扫描项目中发现AndroidOS.Agent、Android/SmsThief.LI!tr
  • ¥15 怀疑手机被监控,请问怎么解决和防止