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");
mysql_select_db("$database");
$sql = "SELECT * FROM news order by date DESC LIMIT 10";
$result = mysql_query($sql);
 
$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.

Thanks in advance
Graham