您好我想检查会员是否购买了产品。如果会员已购买以显示不同的内容。
下面的示例日期:
products
productID, title, runTime, imageLarge, classification
1, noah, 128 minutes, noahLarge.jpg, M
2, left behind, 105 minutes, leftBehindLarge.jpg, MA 15+
3, green lantern, 133 minutes, greenLantern.jpg, M
invoice
invoiceID, memberID, purchaseDate
1,11,1/10/2014
2,13,15/10/2014
productsinvoice
invoiceID, productID
1, 2
1, 3
2, 1
2, 2
members
memberID, username, pass, first name, last name
11, bob, fwofefef, bob, marley
13, prius, f334ff43f, eski, martey
因此,当用户购买产品时,它会显示一点不同,只有在他们购买了该产品时才会以不同方式显示。
if(!isset($_SESSION['user']))
{
echo '
<h4>$'. $row['price'] .'</h4>
<p><input type="button" value="Add to Cart" onclick="addtocart(' .$row['productID'] . ')" class="btn btn-primary" value="Add to cart"/></p>';
}
else {
echo '
<a href="../pages/movieWatch.php?productID='.$row['productID'].'" class="btn btn-success"><span class="glyphicon glyphicon-cloud"> Stream</a> <a href="#" class="btn btn-info"><span class="glyphicon glyphicon-hdd"> Download</a>';
}
在MySQL查询中,我已经加入了发票和产品发票我根本不知道如果条件要写什么。
(if condition logic)
If (the user has purchased this product)
{
}
else (if the user has not purchased this product)
{
}