Pass var from php to swf (twice kind of)

I am trying to pass var pid into index.php which embeds the swf. I am trying to get the swf to take that var pid and request pos.php which has the php db connection/query code, and I need to get those vars from the pos.php back into pos.swf. Please help! I know it looks a little messy; I’ve been trying to figure it out by looking at different guides on this. Thanks in advance!

index.php?pid=1


<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="525" height="355" id="pos" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="pos.swf" />
<param name="FlashVars" value="pid=<?php echo $_GET['pid'];?>">
<param name="quality" value="high" />
<param name="bgcolor" value="#E6E2B9" />
<embed src="pos.swf" quality="high" bgcolor="#E6E2B9" width="525" height="355" name="pos" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>

pos.swf


this.onLoad=function(){
  allinvis();
}

myLoad = new LoadVars();
myLoad.path = this;
myLoad.pid = _root.pid; 
myLoad.onLoad = function(success)
{
            if(success){
                        #include "whatvis.txt"
            } else {
                        trace("PHP PAGE NOT FOUND");
            }
};
myLoad.SendAndLoad("pos.php", myLoad , "GET");

pos.php


<?php
$link = @mysql_connect("localhost", "username", "password")
or die("Could not connect" . mysql_error());
$db = @mysql_select_db("dbname",$link) or die("Could not
select database");

$query = "SELECT * FROM p WHERE pid = '".$pid."'"; 
$result = @mysql_query($query,$link) or 
    die("Could not submit query");

$tmp = mysql_fetch_array($result);

print "&s1=".$tmp[s1];
print "&s2=".$tmp[s2];
print "&loading=NO";

mysql_close($link);
?>