Refreshing the php/MySQL results

Hi guys,

I have a very simple panel for adding some data to MySQL db using php scripts.

The main view of that panel is a list of the collected data and a button to add a row at the end of the current db records.

Here’s the work flow:

  • I click the button to add a record
  • Fill out the form
  • Hit the submit button
  • The record has been added to the db
  • The form disapears and the list of the records is displayed again

The problem is:

  • The list with the records doesn’t include just added record

To solve that problem I came up with an idea to put all the elements within the MovieClip “list”, and try to remove this MovieClip from memmory and redo whole script again.

Submit button of the form has the code to trigger the php script adding the records and tells the timeline to gotoAndPlay(2) which the code you’ll find below.
Unfortunately, that seems to not working.

My script of displaying the data looks like this:

Frame 1 of the timeline:

var phpFileRequest:URLRequest = new URLRequest("php/list.php");
phpFileRequest.method = URLRequestMethod.POST;
var phpLoader:URLLoader = new URLLoader();
phpLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
phpLoader.addEventListener(Event.COMPLETE, displayData);
var textFormat:TextFormat = new TextFormat("Arial Narrow", "12", "0xFFFFFF");
var textGap:uint = 20;
var list:MovieClip = new MovieClip();
list.x = 0;
list.y = 0;
function displayData(evt:Event) {
 for (var i:uint=0; i<; i++) {
  var textLabel:TextField = new TextField();
   textLabel.defaultTextFormat = textFormat;
   textLabel.text =["id"+i];
   textLabel.x = 100;
  textLabel.y = textY;
  textLabel.selectable = false;
  textY = textY + textGap;

Frame 2 of the code:

list = null;

I’m seriously confused, as there is no difference of hangling the request of launching php script on the form that adds the records to database. In fact I can add the data everytime I click the button, and it fires the php script from the beginning with no problem. The same script diesn’t do that with a script displaying the data.

Any suggestions welcome!