you need to define the $row in $_session and not $_session to $row
$_SESSION['id']= $query_array['product_id']; //<---- must reverse it.
$product_id= $_SESSION['id'];
try this
$product_id = $query_array['product_id'] ;
$product_id = $_SESSION['id'];
Or you can pass the ID via $_GET
in your code
echo "<a href='single_product.php?product_id=$product_id' >";
you can get the product_id like that in the other file
echo $_GET['product_id'] ;