orders_detail_qry.php

訂單  (網址)  

<?php require_once('../../../Connections/allianz.php'); ?>
<?php
/*


查詢 orders_detail01 o_id, p_id, p_cnts
主訂單編號,產品編號,數量
查詢 products01 p_id p_name p_spec p_prices
產品編號, 產品名稱,規格,單價

*/

$varo_id = ""; if (isset($_REQUEST["o_id"]) ){ $varo_id =$_REQUEST["o_id"];}

mysql_select_db($database_allianz, $allianz); // 連線資料庫
$sql = " select ";
$sql .= " a.od_id, a.o_id, a.p_id, a.p_cnts, ";
$sql .= " b.p_name, b.p_prices, b.p_name ";
$sql .= " from orders_detail01 a ";
$sql .= " left join products01 b ";
$sql .= " on b.p_id = a.p_id ";
$sql .= " where 1=1 ";
//echo " sql = " . $sql . "<br>";
$Recordset1 = mysql_query($sql, $allianz) or die(mysql_error()); // 執行查詢語法
$row_Recordset1 = mysql_fetch_assoc($Recordset1); // 把查詢的結果帶到$row_Recordset1[]陣列中
$totalRow_Recordset1 = mysql_num_rows($Recordset1); // 把查詢後表格總共有幾列(幾筆資料)放到 $totalRows_Recordset1
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<a href="orders_detail_ins.php?o_id=<?php echo $varo_id;?>">新增訂單</a>
<table border="1">
<tr>
<td>主訂單編號</td>
<td>產品編號</td>
<td>產品名稱</td>
<td>數量</td>
<td>修改</td>
<td>刪除</td>
</tr>
<?php if ( $totalRow_Recordset1>0 ) {?>
<?php do{ ?>
<tr>
<td><?php echo $row_Recordset1["o_id"];?></td>
<td><?php echo $row_Recordset1["p_id"];?></td>
<td><?php echo $row_Recordset1["p_name"];?></td>
<td><?php echo $row_Recordset1["p_cnts"];?></td>
<td>
<input type="button" name="btn_upd" value="修改"
onclick="location.href='orders_detail_upd.php?od_id=<?php echo $row_Recordset1["od_id"];?>&o_id=<?php echo $varo_id;?>';"
style="height:100%;">
</td>
<td>
<input type="button" name="btn_del" value="刪除"
onclick="location.href='orders_detail_del.php?od_id=<?php echo $row_Recordset1["od_id"];?>&o_id=<?php echo $varo_id;?>';"
style="height:100%;">
</td>

</tr>
<?php }while( $row_Recordset1 = mysql_fetch_assoc($Recordset1) );?>

<?php }else{ ?>
<tr>
<td colspan="6">目前尚無資料</td>
</tr>

<?php } ?>

</table>
<hr>

</body>
</html>

arrow
arrow
    文章標籤
    程式語言
    全站熱搜

    ab1628 發表在 痞客邦 留言(2) 人氣()