一切都正确连接,我有一个产品报价表,通过'product_id'链接到我的产品表。我刚刚在产品报价表中添加了一个新的报价,但它工作正常,但是新报价在前端网站上没有更新。
优惠表仍然只显示三种产品,而不是四种产品!
以下是商品表的代码:
<?php
$sql="SELECT a.product_id, a.Options_id, b.product_name, b.product_price, b.product_url, d.product_id, d.image_id, e.filename, e.image_id, h.product_id, h.Offer_price
FROM ProductOptions a
JOIN Products b ON a.product_id = b.product_id
JOIN ProductImage d ON d.product_id = b.product_id
JOIN image e ON e.image_id = d.image_id
JOIN ProductOffer h ON h.product_id = b.product_id
GROUP BY product_name
ORDER BY product_name DESC";
$result = mysql_query($sql);
if (!$result)
{
echo "An error occurred ".mysql_error();
exit;
}
echo "<table border=1>\n<tr><th><th></th></th><th bgcolor=\"#DFE8EC\">Name</th><th bgcolor=\"#DFE8EC\">Price OFFER!</th><th bgcolor=\"#DFE8EC\"></th><th>Product URL</th></tr>\n";
while ($line = mysql_fetch_array($result)) {
$name = $line["product_name"];
$url=$line["product_url"];
$image=$line["filename"];
$offer=$line["Offer_price"];
echo "<tr><td></td><td><img src=\"http://www.ehustudent.co.uk/cis21318867/cis3122/Tiersco%20Pro%20BodyBuilding/storeadmin/images/$image\" border=0></td><td bgcolor=\"#DFE8EC\">$name</td><td bgcolor=\"#DFE8EC\">£$offer</td><td bgcolor=\"#DFE8EC\"></td><td><a href= $url > More Info </a></td></tr>\n";
}
echo "</table>\n";
?>
当新的商品被插入数据库
时,while循环肯定会继续更新