Dynamically loading MySQL data into text field

Ok, I know this has been covered countless times but regardless of the numerous tutorials, posts etc. that I read I cannot get flash to read in my mysql data. I can make it read in a simple variable i.e.

$x = "abc";
print "varname=$x";

… but as soon as I add anything else into it, it fails. Even just addign the mysql connect lines infront of what I have there will cause it to fall over.
What I need is basically how to code the following PHP script and the action script (or even an explanation of how to alter it).

 
mysql_connect("$host", "$user", "$password")or die("<h2>There was a problem connecting to the database. Try again later.
 Alternativly, go to Namik's myspace account.</h2>
 <p><a href='http://www.myspace.com/namik'>Click here to go to myspace.</a>"); 
 mysql_select_db("$database")or die("cannot select DB");
 $sql = "SELECT * FROM news order by date DESC LIMIT 10";
 $result = mysql_query($sql) or die('Database error: ' . mysql_error());

$anc = 1;
 while ($newArray = mysql_fetch_array($result)) {
  
  $id = $newArray['id'];
  $news = stripslashes($newArray['news']);
  $date = $newArray['date'];
  $head = stripslashes($newArray['head']);
  $date = date("d/m/Y", strtotime($date));
  print"***$date and $news should be printed here***"
  ++$anc;
 }

Honestly try as I might, I cannot get this to display.

Thansk