Could I Get Someone To Look Over My Code - Trying To Make A Chat

Hey, I’m pretty new to Flash MX and I’ve been using PHP for a while so I probaly have some mistakes in both but my chat won’t seem to load any messages. I can send them fine but loading won’t work. My is…

Flash - Frame - Show Messages


function (getMSG) {
q = new LoadVars();
q.last = _global.last;
q.sendAndLoad("recieve.php",q,"GET");
q.onLoad = function() {
if (q.s == 1){
_global.msg = q.se + ": " + q.msg;
_root.chat.text = _root.chat.text + _global.msg;
} else {
_root.chat.text = "~Error Connecting With Server~"
}
}
}
_global.last = "0";
setInterval(getMSG,1000);

PHP - Recieve.php


<?
#Load Community Settings
require("../config.php");
#Check is user is logged in
if (isset($HTTP_COOKIE_VARS['comm'])){
#Get username
$data = explode("|",$HTTP_COOKIE_VARS['comm']);
$user1 = $data[0];
 
#Get Variables From Flash
$last = $HTTP_GET_VARS['last'];
 
#Get New Messages
$connection =mysql_connect($host,$user,$pass) or die(mysql_error());
mysql_select_db($dbase,$connection);
$sql = mysql_query("SELECT * FROM Chat_Msgs WHERE ID > '$last'",$connection) or die("s=0");
if ($data = mysql_fetch_assoc($sql)) {
		$sender = $data['user'];
$msg = $data['msg'];
$newlast = $data['ID'];
}
 
#Send Variaibles back to Flash
echo "s=1&l=$newlast&msg=$msg&se=$sender";
} else {
echo "s=0";
}
?>

In my flash movie I have a dynamic text box with a instance name of chat where all the messages are supposed to show up. I can get messages to show up if I set it so you have to press a button to show messages everytime but thats not going to work for a chat so can anyone see what I’m doing wrong here?

Any Help Is Appriecated!