我正在创建一个用于论文目的的在线订购系统。 我在显示客户购买的所有产品时遇到了问题。
<?php
if(isset($_SESSION['user_id'])){
$id = $_SESSION['user_id'];
$sql_cus ="SELECT c.lname,c.fname,c.email,c.c_num,c.homeadd,c.barangay,c.city,c.province,
der.code,der.date,od.orderid
FROM customer c
LEFT JOIN orders der
ON der.customer_id=c.id
LEFT JOIN order_details od
ON der.id=od.orderid
LEFT JOIN products p
ON od.productid = p.id
WHERE c.id ='$id'
LIMIT 1";
$result_cus = mysql_query($sql_cus,$connection);
check_if_connected($result_cus);
$count_cus = mysql_num_rows($result_cus);
if($count_cus>0){
while($row=mysql_fetch_array($result_cus)){
$id = $row['id'];
$lname = $row['lname'];
$fname = $row['fname'];
$email = $row['email'];
$c_num = $row['c_num'];
$home = $row['homeadd'];
$barangay = $row['barangay'];
$city = $row['city'];
$province = $row['province'];
$orderid = $row['orderid'];
$code = $row['code'];
$date = $row['date'];
}
}
else{
echo "Wala";
}
}else{
}
?>
Order No.: <?php echo $code;?><br /><br />
Order Date: <?php echo $date;?><br /><br />
Delivered to:<br /><br />
Name: <?php echo $lname.", ".$fname;?><br />
Address: <?php echo $home." ".$barangay." ".$city.", ".$province;?><br />
Email: <?php echo $email;?><br /><br />
<br />
Order Details<?php echo $orderid;?><br />
有什么想法吗?或者有人可以帮我这个吗?
提前致谢