0

hey guys, i have created a page called prod_det.php. the page displays the details of the product. below is the code. but it is not working. error message being received when i click the details button is Warning: mysql_fetch_array() expects parameter 1 to be 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
Contributor
2
Replies
13
Views
4 Years
Discussion Span
Last Post by sanbhu2105
0

Oops my mistake...i found the error...sorry guys

error was in the select statement

0

now the issue is that there is a product details button for each product display. when i click on my product details button, details of all products are displayed and not the details of the product i clicked. Any help in solving that please?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.