|
|
|
รบกวนขอคำแนะนำหน่อยนะคะ หน้าview_order ไม่สามารรวมยอดขายได้ค่ะ |
|
|
|
|
|
|
|
ลองเอา code หน้านี้มาดูครับ เผื่อจะได้เข้าใจมากกว่านี้
|
|
|
|
|
Date :
2017-09-01 14:35:57 |
By :
thesin18598 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<table width="304" border="1">
<tr align="center">
<td width="100"><font size="4" face="TH Kodchasal">OrderID</font></td>
<td width="100">
<?php echo $objResult["OrderID"];?></td>
</tr>
<tr align="center">
<td width="100"><font size="4" face="TH Kodchasal">Name</font></td>
<td width="100">
<?php echo $objResult["Name"];?></td>
</tr>
<tr align="center">
<td width="100"><font size="4" face="TH Kodchasal">Adderss</font></td>
<td width="100"><?php echo $objResult["Address"];?></td>
</tr>
<tr align="center">
<td width="100"><font size="4" face="TH Kodchasal">Tel.</font></td>
<td width="100"><?php echo $objResult["Tel"];?></td>
</tr>
<tr align="center">
<td width="100"><font size="4" face="TH Kodchasal">EmaiI</font></td>
<td width="100"><?php echo $objResult["Email"];?></td>
</tr>
</table>
<p><br>
</p>
<table border="1">
<tr>
<td width="100" align="center"><font size="4" face="TH Kodchasal">ProductID</font></td>
<td width="100" align="center"><font size="4" face="TH Kodchasal">ProductName</font></td>
<td width="100" align="center"><font size="4" face="TH Kodchasal">Price</font></td>
<td width="100" align="center"><font size="4" face="TH Kodchasal">QTy</font></td>
<td width="100" align="center"><font size="4" face="TH Kodchasal">Total</font></td>
</tr>
<?php
$Total = 0;
$SumTotal = 0;
$strSQL2 = "SELECT * FROM order_detail WHERE OrderID = '".$_GET["OrderID"]."' ";
$objQuery2 = mysql_query($strSQL2) or die(mysql_error());
while($objResult2 = mysql_fetch_array($objQuery2))
{
$strSQL3 = "SELECT * FROM product WHERE ProductID = '".$objResult2["ProductID"]."' ";
$objQuery3 = mysql_query($strSQL3) or die(mysql_error());
$objResult3 = mysql_fetch_array($objQuery3);
$Total = $objResult2["Qty"] * $objResult3["Price"];
$SumTotal = $SumTotal + $Total;
?>
<tr>
<td width="100" align="center"><?php echo $row_Recordset2['ProductID']; ?></td>
<td width="100" align="center"><?php echo $row_Recordset2['ProductName']; ?></td>
<td width="100" align="center"><?php echo $row_Recordset2['Price']; ?></td>
<td width="100" align="center"><?php echo $objResult2["Qty"];?></td>
<td width="100" align="center"><?php echo number_format($Total,2);?></td>
</tr>
<?php
}
?>
</table>
<p> </p>
<table width="400" border="0">
<tr>
<td width="300" align="center">Total</td>
<td width="73" align="right"><?php echo number_format($SumTotal,2);?></td>
<td width="13">
</tr>
</table>
|
|
|
|
|
Date :
2017-09-01 16:38:26 |
By :
1534501919968176 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<html>
<head>
<title>ThaiCreate.Com</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<?php
mysql_connect("localhost","root","root");
mysql_select_db("mydatabase");
$strSQL = "SELECT * FROM orders WHERE OrderID = '".$_GET["OrderID"]."' ";
$objQuery = mysql_query($strSQL) or die(mysql_error());
$objResult = mysql_fetch_array($objQuery);
?>
<table width="304" border="1">
<tr>
<td width="71">OrderID</td>
<td width="217">
<?php echo $objResult["OrderID"];?></td>
</tr>
<tr>
<td width="71">Name</td>
<td width="217">
<?php echo $objResult["Name"];?></td>
</tr>
<tr>
<td>Address</td>
<td><?php echo $objResult["Address"];?></td>
</tr>
<tr>
<td>Tel</td>
<td><?php echo $objResult["Tel"];?></td>
</tr>
<tr>
<td>Email</td>
<td><?php echo $objResult["Email"];?></td>
</tr>
</table>
<br>
<table width="400" border="1">
<tr>
<td width="101">ProductID</td>
<td width="82">ProductName</td>
<td width="82">Price</td>
<td width="79">Qty</td>
<td width="79">Total</td>
</tr>
<?php
$Total = 0;
$SumTotal = 0;
$strSQL2 = "SELECT * FROM orders_detail WHERE OrderID = '".$_GET["OrderID"]."' ";
$objQuery2 = mysql_query($strSQL2) or die(mysql_error());
while($objResult2 = mysql_fetch_array($objQuery2))
{
$strSQL3 = "SELECT * FROM product WHERE ProductID = '".$objResult2["ProductID"]."' ";
$objQuery3 = mysql_query($strSQL3) or die(mysql_error());
$objResult3 = mysql_fetch_array($objQuery3);
$Total = $objResult2["Qty"] * $objResult3["Price"];
$SumTotal = $SumTotal + $Total;
?>
<tr>
<td><?php echo $objResult2["ProductID"];?></td>
<td><?php echo $objResult3["ProductName"];?></td>
<td><?php echo $objResult3["Price"];?></td>
<td><?php echo $objResult2["Qty"];?></td>
<td><?php echo number_format($Total,2);?></td>
</tr>
<?php
}
?>
</table>
Sum Total <?php echo number_format($SumTotal,2);?>
<?php
mysql_close();
?>
</body>
</html>
|
|
|
|
|
Date :
2017-09-01 17:26:23 |
By :
Bouasavanh HararRock |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
เมื่อวานหลังจากทำเสร็จแล้วลองทดสอบดูมันมานะคะ พอมาเปิดวันนี้มันไม่มาเฉยเลย
ยังไงก็ขอบคุณสำหรับคำแนะนำนะคะ จะไปลองทำให้ก่อนค่ะ ถ้าติดขัดยังไงจะขอรบกวนอีกนะคะ
|
|
|
|
|
Date :
2017-09-01 17:43:20 |
By :
1534501919968176 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|