仅在关闭按钮的弹出窗口中显示产品详细信息

时间:2013-07-07 12:36:02

标签: php mysql

我创建了一个名为prod_det.php的页面。该页面显示产品的详细信息。下面是代码。但它不起作用。单击详细信息按钮时收到错误消息警告:mysql_fetch_array()期望参数1为resource,boolean

<?php
session_start();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Product</title>
<link href="CSS/product.css" rel="stylesheet" type="text/css" />
</head>

<body>

<?php 

//Create the connection and select the DB 
include('db_connect.php'); 

// Select records from the DB 

$query = "SELECT p.prod_name, p.prod_photo, pr.prod_price, pr.prod_desc, pr.prod_brand, pr.prod_w_c
          FROM tblproduct p
          INNER JOIN tblretprod pr ON p.prod_id = pr.prod_id"; 
$result = mysql_query($query); 

// Display records from the table ?>

<?php while ($row = mysql_fetch_array($result)): ?>

<div class="prod_box_big">
     <div class="top_prod_box_big"></div>
        <div class="center_prod_box_big">            

             <div class="product_img_big"><?= '<img height="100" width="100" src="Images/Products/'.$row['prod_photo'].'"/>'; ?>
               <div class="thumbs"><?= $row['prod_desc']; ?></div>
          </div>
                 <div class="details_big_box">
                     <div class="product_title_big"><?= $row['prod_name']; ?></div>
                     <div class="specifications">
                        Brand: <span class="blue"><?= $row['prod_brand']; ?></span><br />

                        Quantity: <span class="blue"><?= $row['prod_w_c']; ?></span><br />

                        Price include <span class="blue">TVA</span><br />
                     </div>
                     <div class="prod_price_big"><span class="reduce"><?= $row['prod_price']; ?>   </span> <span   class="price">%promo%</span></div>

                     <a href="#" class="addtocart">add to fav</a>
                     <a href="#" class="compare">compare</a>
                 </div>                        
        </div>
        <div class="bottom_prod_box_big"></div>                                
</div>
<?php endwhile; ?> 

</body>
</html>

1 个答案:

答案 0 :(得分:0)

这意味着您的查询失败,因此$ result将设置为FALSE。

您可以通过调用mysql_error function来查看错误消息。