<?
include ("connection.php");

$id=$_GET["id"];

$requete="SELECT \"NAME\",\"SPECIES\" from \"EMBRYO\" where \"EMBRYO_ID\"='$id'";
$stmt=pg_query($c,$requete);
$row=pg_fetch_array($stmt);

$name=$row["NAME"];
$name=str_replace("@","_",$name);
$name=str_replace(" ","_",$row["SPECIES"])."_".$name;

//////////header force download ///////////////////////
header("Content-disposition: attachment; filename=$name.$id.SV.txt");
header("Content-Type: application/force-download");
header("Content-Transfer-Encoding: text/plain\n"); // Surtout ne pas enlever le \n
header("Pragma: no-cache");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0, public");
header("Expires: 0");




$devid=$row["DEV_STAGE_ID"];

print "#cell / surface µ2/ volume µ3\n";
print "#devstage=$devid\n";


$requete="SELECT \"CELL\",\"VOLUME\",\"SURFACE\" from \"EMBRYO_BIOMETRY\" where \"EMBRYO_ID\"='$id'";
//print $requete."<br>";
$stmt=pg_query($c,$requete);
while ($row=pg_fetch_array($stmt))
{
$cell=$row["CELL"];
$requete0="SELECT \"NAME\" from \"ANAT_ENTITY\" where \"ANAT_ID\"='$cell'";
$stmt0=pg_query($c,$requete0);
$row0=pg_fetch_array($stmt0);
$anatname=$row0["NAME"];
$vol=$row["VOLUME"];
$surf=$row["SURFACE"];
print "$anatname\t$surf\t$vol\n";
}








?> 
