如何使我的PHP表从另一个表

时间:2018-08-01 02:18:44

标签: javascript php jquery html mysql

我的网站上有一张桌子,上面的代码是this is the table image

此表的代码

<?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>';
    }
?>

我只想在当前表的底部创建一个新表,其中我选择的行仅被“处理”

我只希望将此行放入新表see this image 当“处理中”状态将被处理时,它将自动进入新表。请帮助我创建此查询。

这是我的数据库映像,my database image我只想要整个表行都是“ 4”,请帮忙。

1 个答案:

答案 0 :(得分:0)

这听起来有点简单,但是为什么不将第一个 db-query 更改为:

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

然后您将不会获得 status 为4的行。 然后继续制作一个新表,该表类似于您通过查询创建的表

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

然后可以删除elseif检查(elseif($row['status'] == "4")。

您的第二张表- code 看起来像这样:

<?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>