Loading variables from external PHP script

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • brixton
    New Member
    • Nov 2006
    • 35

    #1

    Loading variables from external PHP script

    Hello there,

    I'm using Flash to present data which I am pulling out of a MySQL database using a PHP script.

    The setup is like this; in the frame in which I want to present the data I have a loadVariables line which loads the data into a dynamic text field variable. The PHP script opens up a database connection, runs a couple of queries, then closes the connection.

    The problem is, that it doesn't work very consistently. When I jump back to the previous frame in the Flash movie and then back, only sometimes does it "reload" the variables. It could have something to do with the SQL connection but I'm not sure.

    Anyone knows what might be an issue here?

    Thanks in advance...
  • evilbatusai
    New Member
    • Oct 2007
    • 1

    #2
    Originally posted by brixton
    Hello there,

    I'm using Flash to present data which I am pulling out of a MySQL database using a PHP script.

    The setup is like this; in the frame in which I want to present the data I have a
    loadVariables line which loads the data into a dynamic text field variable. The PHP script opens up a database connection, runs a couple of queries, then closes the connection.


    The problem is, that it doesn't work very consistently. When I jump back to the previous frame in the Flash movie and then back, only sometimes does it "reload" the variables. It could have something to do with the SQL connection but I'm not sure.

    Anyone knows what might be an issue here?

    Thanks in advance...

    If your php script places all the mysql data in one variable and then printed,
    example:
    while ($sqlData = mysql_fetch_arr ay($sqlDatabase ))
    {
    $my_sqlData .= sqlData['entry']; //keeps adding data to one
    variable
    }

    print "flashTextField =$my_sqlData";// prints the entire data

    this might take a very long time and might pose problems. A better practice would be to print the data right away.
    example:

    print "flashTextField ="; //enters blank text just to declare where to print the
    data
    while ($sqlData = mysql_fetch_arr ay($sqlDatabase ))
    {
    $my_sqlData = sqlData['entry'];
    print "$my_sqlDat a";// prints data one at a time. It won't overwrite previous
    data.
    }


    if thats not the prob, then something in flash might be preventing the php script from running properly..maybe flash functions not executing at the right time or something. Or possibly, flash variables are not being reloaded or something..i'm a newbie too..lol

    Comment

    • Vijayasekar
      New Member
      • Sep 2007
      • 2

      #3
      Hi Brixton,

      Just my guess, this could be due to caching in the browser.
      Did you try disabling the caching in the PHP?

      <?php header("Cache-Control: no-cache, must-revalidate");

      Hope this helps...

      Comment

      Working...