首页 > 解决方案 > 数据库中有两个不同的表我想按日期或时间顺序从一个表中获取数据?

问题描述

if(isset($_GET['buyer_id'])){
    $buyer_id = $_GET['buyer_id'];
    $buyer_query = mysqli_query($conn, "SELECT * FROM new_entry_table where buyer_id = '$buyer_id'");
    if(mysqli_num_rows($buyer_query) > 1){

        $i = 1;

        while($show = mysqli_fetch_array($buyer_query)){

            $v_p_store = $show['per_vihicle_price'];
            $store_sum = $v_p_store + @$store_sum;
//**************************************
            $vihicle_id = $show['vihicle_id'];
            $select_vihicle = mysqli_query($conn, "SELECT * from vihicles where id = '$vihicle_id'");$store_vihicle = mysqli_fetch_array($select_vihicle);

            $mine_id = $show['id'];
            $select_mines = mysqli_query($conn, "SELECT * from mines where mine_id = '$mine_id'");$store_mine = mysqli_fetch_array($select_mines);
            ?>
            <tr>
                <td><?php echo $i++; ?></td>

                <td><?php echo $show['date']; ?></td>
                <td><?php echo $store_vihicle['vihicle_type'] . " " . $store_vihicle['vihicle_no']; ?></td>
                <td><?php echo $store_mine['mine_name'] . " # " . $store_mine['mine_no']; ?></td>
                <td><?php echo "KG- " . $show['weight']; ?></td>
                <td><?php echo "RS- " . $show['price']; ?></td>
                <td><?php echo "RS- " . $show['per_vihicle_price']; ?></td>
                <td><?php echo "RS- " . $store_sum; ?></td>
                <td>0</td>
            </tr>
        <?php }
    }
}

PHP 我想从两个表中获取数据,比如 frombuyer_record和 from hr_recieve_payment

数据库中有两个不同的表我想按日期或时间顺序从一个表中获取数据?

标签: php

解决方案


先生,我的帖子是针对一位买家从我那里贷款购买的东西,我将把这笔贷款添加到表中,但每当他们支付贷款时,我想在同一页面显示按照购买价格支付的贷款。数据库表不同。


推荐阅读