0

我想创建订单历史记录,但只有当前用户已“登录”的订单。有人可以帮助我吗?

<?php
include("includes/db.php");
include("authentication.php");

session_start();
$id=$_GET["id"];
$query="SELECT * FROM order_detail";
$result=mysql_query($query);

if($_SESSION["sessionusername"])
{
echo" <html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1' />
<title>Untitled Document</title>
</head>
<body>
<table align='center' width='40%'>
<tr><td width='10%'><img src='image/banner.jpg' width='1000' height='150' alt='Master'><td></tr>                   
</table>
<table align='center' width='70%'>
<tr>
<td width='10%' align='center'><a href ='home.php'>Home</a></td><td width='15%'        align='center'><a href='aboutus.php'>About Us</a></td>
<td width='14%' align='center'><a href='news.php'>News</a></td><td width='13%'   align='center'><a href='products.php'>Products</a></td>
<td width='14%' align='center'></td>
<td width='13%' align='center'><a href='checkhistory.php'>Order History</a></td>
</tr>
</table>"; }
else
{ 
echo "<center>You Must Login First !</center>"; 
}
  ?>


<?php


while($data=mysql_fetch_array($result))
{
 $orderid=$data["orderid"];
$productid=$data["productid"];
$quantity=$data["quantity"];
$price=$data["price"];
$serial=$data["serial"];
$name=$data["name"];
$description=$data["description"];
?>
<table><tr><td>Order id : <?php echo $orderid ?></td>
<td>Order id : <?php echo $productid ?></td> <td>Order id : <?php echo $quantity?></td>
<td>Order id : <?php echo $price ?></td> <td>Order id : <?php echo $Serial ?></td>
<?php }?>
</tr></table>

我想制作订单历史。如果我自动单击订单历史记录,它将显示已“登录”的当前用户已订购的订单详细信息

我真的很困惑该怎么做..请helpppp !!

非常感谢

4

1 回答 1

0

您必须WHERE user_field = :currentUserName在 SQL 查询中添加user_field您的用户标识符在您的订单表中的位置,并且:currentUserName是您的当前用户

于 2013-09-18T09:57:15.990 回答