php - 数据库中有两个不同的表我想按日期或时间顺序从一个表中获取数据?
问题描述
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
。
数据库中有两个不同的表我想按日期或时间顺序从一个表中获取数据?
解决方案
先生,我的帖子是针对一位买家从我那里贷款购买的东西,我将把这笔贷款添加到表中,但每当他们支付贷款时,我想在同一页面显示按照购买价格支付的贷款。数据库表不同。
推荐阅读
- codenameone - cn1lib 工作所需的最低 Java 版本
- java - 使用泛型类从其他类访问其他方法
- qt - 为什么它在函数中使用 d->eventFilters.prepend(obj) 而不是 append(obj) (QObject::installEventFilter)
- excel - Excel - 有条件地从多个 csv 文件中提取数据
- python - 使用接收错误的神经实验室构建矢量量化器
- javascript - 将动态值与对象中的 object.keys 匹配
- r - 如何将 data.frame 转换为多边形列表?
- html - 在 index.html 前面添加一个随机字符有什么作用?
- css - 如何在它们之间添加空格并保持文本在同一行
- c# - 获取具有深层相关实体的对象