Hi
I am trying to update a table in my database by sending the variables from actionscript to PHP,but the table is not getting updated.There are no errors at all.
My code is below:
*fla code
OK_btn.addEventListener(MouseEvent.CLICK,Submit);
function Submit(event:MouseEvent):void{
OK_btn.visible=false;
var myRequest:URLRequest = new URLRequest(“DBStore.php”);
var variables:URLVariables=new URLVariables();
var sVF,sVB,sAF,sAB,sTotal:String;
var Total=digit+vbdigit+afdigit+abdigit;
        variables.VF="5";
        variables.VB="6";
        variables.AF="8";
        variables.AB="9";
        
        variables.Total="15";
        
        myRequest.method=URLRequestMethod.POST;
        myRequest.data=variables;
        var myLoader:URLLoader=new URLLoader();
        myLoader.dataFormat=URLLoaderDataFormat.VARIABLES;
        myLoader.addEventListener(Event.COMPLETE, onLoaded);
        trace(variables);
        try 
        {
            myLoader.load(myRequest);
        } 
        catch (error:Error) 
        {
            trace('Unable to load requested document.');
        }
myLoader.addEventListener(Event.COMPLETE, onLoaded);
function onLoaded(e:Event):void
{
var loader:URLLoader=URLLoader(e.target);
var vars:URLVariables=new URLVariables(loader.data);
Test.text=vars.answer;
if(vars.answer==“ok”)
{
trace(“ok”);
        }
        else if(vars.answer=="nope")
        {
        trace("nope");
        }
    }
}
*php code
<?php
/******** CHANGE YOUR DATABASE SETTING *******/
$dbhost = ‘205.178.146.76’; // database host
$dbuser = ‘user’; // database username
$dbpass = ‘pwd’; // database password
$dbname = ‘DB’; // database name
$mysql = mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($dbname);
/* VARIABLES FROM FLASH */
$tVF=$_POST[‘VF’];
$tVB=$_POST[‘VB’];
$tAF=$_POST[‘AF’];
$tAB=$_POST[‘AB’];
$tTotal=$_GET[‘Total’];
/INSERT INTO DB/
$Query=“INSERT INTO Score( ID.VF, VB, AF, AB, Final )VALUES (”",’".$tVF."’, ‘".$tVB."’, ‘".$tAF."’, ‘".$tAB."’, ‘".$tTotal."’)";
);
;
/* ECHO TO FLASH */
if(mysql_query($Query))
{
$answer='ok';
    
echo "answer=".$answer;
}
else
{
$answer=‘nope’;
echo "answer=".$answer;
}
?>
Please Tell me where I am going wrong…Have been banging my head with this code for the past 2 days…
HELP!!!