如何从另一个表创建我的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>

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>