# Actionscript 3 , php and mysql

**URL:** https://forum.kirupa.com/t/actionscript-3-php-and-mysql/322473
**Category:** flash
**Created:** [May 22, 2011, 9:02pm UTC](https://forum.kirupa.com/t/actionscript-3-php-and-mysql/322473 "2011-05-22T21:02:14Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![sean7725](https://avatars.discourse-cdn.com/v4/letter/s/d9b06d/32.png) [@sean7725](https://forum.kirupa.com/u/sean7725)
#### Post date: [May 22, 2011, 9:02pm UTC](https://forum.kirupa.com/t/actionscript-3-php-and-mysql/322473/1 "2011-05-22T21:02:14Z")

</div>

Everything works exept when I change any information in mysql and then run the actionscript the new data isn’t loaded I am seeing the previous data. It’s not updating. Can someone one please explain to me what I am missing?  
When I shut down flash CS5 and reopen it then rerun the actionscript I get the new information. But I should be able to load the new information without having to shutdown flash and reopen it.

Thank you.

I have the following code in my actionscript:  
import flash.display.MovieClip;  
import flash.events._;  
import [flash.net](http://flash.net)._;

var request:URLRequest = new URLRequest(“[http://localhost/Game.php](http://localhost/Game.php)”);  
request.method = URLRequestMethod.GET;  
var loader:URLLoader = new URLLoader();  
loader.dataFormat = URLLoaderDataFormat.VARIABLES;  
loader.addEventListener(Event.COMPLETE, completeHandler);  
loader.load(request);  
function completeHandler(evt:Event) {  
var pointsVar = evt.target.data.points;  
var slootVar = evt.target.data.sloot;  
var dartVar = evt.target.data.dart;  
trace ('Points is ’ + pointsVar);  
trace ('Sloot is ’ + slootVar);  
trace ('Darts are ’ + dartVar);  
}

The php script looks like this:  
\<?php  
$username=“Sean”;  
$points="";  
$sloot="";  
$dart="";

include ‘connect.php’

$query = “SELECT \* FROM whatever where User=’$username’”;  
$result = mysql\_query($query);

$row = mysql\_fetch\_array($result) or die(mysql\_error());

$username= $row[‘User’];  
$points= $row[‘Points’];  
$sloot= $row[‘Sloot’];  
$dart= $row[‘Darts’];  
echo “User :$username \<br\>”.  
“Points :$points \<br\>”.  
“Sloot :$sloot \<br\>”.  
“Darts :$dart \<br\>”;

$returnVars = array();  
$returnVars[‘username’] = $username;  
$returnVars[‘points’] = $points;  
$returnVars[‘sloot’] = $sloot;  
$returnVars[‘dart’] = $dart;  
$returnString = http\_build\_query($returnVars);  
//send variables back to Flash  
echo $returnString;

?\>
