Get URL Variable php send it to SWFOBJECT

Hello all
Been battling with this for a little while and am very close. Hoping someone can help me fill in the final piece I need here.
I’m retrieving a url variable with php. I am trying to send the name of a picture to swfobject variable in order to display a picture in a flash zoom script.

<body>
<div id="zoom"></div>

<?php

$links = mysql_connect("localhost", "Username", "XXXXXX")  ;
$res=mysql_select_db("xxxxx",$links);


if(is_numeric($_GET['id'])){
$id=mysql_real_escape_string($_GET['id']);
}else{
$id="The current id is not a number!";
}

if($id){

$query = "select * from links where id='$id'";

$results = mysql_query($query)or die("Query error
".mysql_error());


while ($line = mysql_fetch_assoc($results)) {
echo $line['description'];
 
}


mysql_close($links);

}else{
	
	echo $id;
}
?>


<script type="text/javascript">
        // <![CDATA[
            var so = new SWFObject('zoom.swf', 'zoom', '600px', '600px', '8', '#CCCCCC');
            so.useExpressInstall('swfobject/expressinstall.swf');
		    so.addParam("wmode","transparent");
			so.addVariable("image", "<?php echo $line['image'] ; ?>"); 
		    so.write("zoom");
        
		// ]]>
</script>

</body>

The description Text pulls up fine and I can reference the rest of the info in the row no problem just stuck on getting it into the flash file now. Anyone had experience with this before? I’m assuming it’s because I’m closing the php script before I’m retrieving the variable but I can’t seem to include the Javascript in echo I tried that with no love.