I'm retrieving products from my database and listing them in a while loop. Like this

      while($row = mysql_fetch_row($result)){

        echo '<div class="product_info">';
         echo '<div class="category_product_title"><a href="category-page.php">Product</a>';
         echo '</div>';
          echo '<div class="category_product_number">#'.$row[0].'('.$row[1].')'.'</div>';//prints id and name
         echo '<div class="category_product_description">'.$row[2].'</div>';//prints description
         echo '<div class="category_product_price">'.$row[4].'TL</div>';//prints price
          echo '<div class="category_details"><a href="productpage2.php">DETAILS</a></div>';//The link to   list the product details
        echo '</div>';
        echo '</div>';

I want to be able to print more details on a paticular prodcut when the "DETAILS" link is clicked by getting the id or name of that paticular product and using to query the database. Since i'm retrieving these products in a loop, i'm not sure how to get the id or the name of a clicked product. I would appreciate any help thanks.


You could add the product number to the link:
echo '<div class="category_details"><a href="productpage2.php?prodnum=' . $row[0] . '">DETAILS</a></div>';

Then in productpage2.php you can retrieve the value with
$product_number = $_GET['prodnum'];