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

```
<?php
  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. 
I tried saving the id in a session variable like this `$_SESSION['id'] = $row[0]` but since i'm looping through these products, i'm not able to get the id of a specific product when it is clicked. How can i do this?. I'm confused because of the loop. Thanks