这个怎么样?这是我的代码的顶部,但我认为这是无助的。每次三阶计算都是错误的。
<?php
include("dbconnection.php");
if ($_SESSION["loggedin"] != "true")
header("Location:memberlogin.php");
$cust_id = $_SESSION["cust_id"];
从数据库中选择所有
$result = mysql_query("select customer.*, product.*, order_details.* from customer, product, order_details where customer.cust_id=$cust_id and product.pro_id=product.pro_id and order_details.order_details_id = order_details.order_details_id")or die(mysql_error());
$row = mysql_fetch_assoc($result);
?>
<?php
$x=1;
$bill_total=5.00;
$order_stotal=$row["order_stotal"];
$result = mysql_query("select product.*,order_details.* from product,order_details
where order_details.pro_id= product.pro_id ");
while($row=mysql_fetch_assoc($result))
{
?>
我需要它来呼应所有可能的小计。我想我只需要编辑这个或我不太确定的东西
<?php
$x++;
$bill_total +=$order_stotal;
}
?>
RM  
<?php
echo number_format($bill_total,2);
?>
那么这里的这个就是按钮的功能
<?php
if(isset($_POST["submitbtn"]))
{
$bill_id=rand(1000,9999);
$bill_date=date("Y-m-d");
$bill_state=$_POST["bill_state"];
$bill_city=$_POST["bill_city"];
$bill_add=$_POST["bill_add"];
$bill_post=$_POST["bill_post"];
mysql_query("insert into bill
(cust_id, bill_date, bill_total, bill_state, bill_city, bill_add,
bill_post)
values('$cust_id','$bill_date',
'$bill_total', '$bill_state', '$bill_city','$bill_add','$bill_post')")or die(mysql_error());
}
?>