我有网上商店,在为每笔订单制作账单时遇到问题

假设有人买了2吨t-shart和1只鞋子,它将添加到手推车表中,其中有prodcutid,usreid,Quantity,现在,如果用户确认订单,我如何用他购买的所有物品创建账单并将其保存到新数据库命名票据

请注意,同一用户可能对不同的项目有不同的账单

这是显示订单和总价的代码

 function CallMyOrder($identificador) { global $database_connectoos, $connectoos; mysql_select_db($database_connectoos, $connectoos); $query_CoryFuncion = sprintf("SELECT * FROM tbltrolley WHERE idUser = %s AND tbltrolley.intOrderDone = 1 , $identificador); $CoryFuncion = mysql_query($query_CoryFuncion, $connectoos) or die(mysql_error()); $row_CoryFuncion = mysql_fetch_assoc($CoryFuncion); $totalRows_CoryFuncion = mysql_num_rows($CoryFuncion); ?> <?php if ($totalRows_CoryFuncion > 0) { // Show if recordset not empty echo " <li> User : &nbsp;".CallUserName($row_CoryFuncion['idUser']); $totalPrice =0; $pricemultnumber; do { $pricemultnumber = $row_CoryFuncion['intQuantity'] * CallProductPrice($row_CoryFuncion['idProduct']); echo "<li><br>"; echo "<img src='../document/product/".CallProductImage($row_CoryFuncion['idProduct'])."' border='0'/>"; echo "Product Name : &nbsp;".CallProductName($row_CoryFuncion['idProduct']); echo "<br>"; echo "Quantity : &nbsp;".$row_CoryFuncion['intQuantity']; echo "<br>"; echo "Price : ".$pricemultnumber." RM"; echo "<br></li>"; $totalPrice = $totalPrice + $pricemultnumber; } while ($row_CoryFuncion = mysql_fetch_assoc($CoryFuncion)); echo "<br>"; echo "<p style='font-size: 24px; font-weight: bold;'>Tax : ".CallTax()."</p>"; $multp = (100 + CallTax())/100; $totalPrice = $totalPrice * $multp; echo "<p style='font-size: 24px; font-weight: bold;'>Total Price = ".$totalPrice." RM</p>"; } 

  ask by user3705799 translate from so

本文未有回复,本站智能推荐: