The way you do it is to pass a parameter into the SWF file. You can make a variable called "id" and pass it into Flash. Then in the Flash movie, you take the value of "id" and make a link based on that.
This way, the PHP creates the code that embeds the Flash movie and the variable can be whatever it should be in that situation.
Let's put it another way: Let's say that the Flash movie shows a picture of a horse and the Flash movie is programmed so that clicking the horse links you to Google. But you want the Flash movie to link you to www.mywebsite.com/xyz?x=$id If your technique of wrapping the Flash movie in an <a href> tag worked, then which link would be honored when the user clicks the horse? Google or your link?
Therefore, the only way to make it work is to call the Flash movie, pass in a parameter (that is dynamically written by PHP) and then have the Flash movie make the horse (or the entire stage) link to whatever link is appropriate for the value that you passed into the Flash movie.