Welcome, Guest
  • Author Topic: can't get variables from php to flash (!?)  (Read 2744 times)

    alek

    • Server what's that
    • *
    • Posts: 5
      • View Profile
      • Email
    can't get variables from php to flash (!?)
    « on: 02/01/05, 16:37 »
    Everything seems to be fine.
    I have this php script wich takes out a querry from MySQL
    and puts it all in a variable &wynik, then printing it.
    Here:
    Code: [Select]


    <?php<br>// Require the database class<br>require_once('includes/DbConnector.php');<br><br>// Create an object (instance) of the DbConnector<br>$connector = new DbConnector();<br><br>// Execute the query to retrieve articles<br>$result = $connector->query('SELECT data,klub,kto FROM lezbend_kal ORDER BY data DESC');<br><br>// Get an array containing the results.<br>// Loop for each item in that array<br><br>$wynik = "";<br>while ($row = $connector->fetchArray($result)){<br><br>$tmp = $row['data'];<br>$tmp2 = $row['klub'];<br>$tmp3 = $row['kto'];<br>$tmp4 = "$tmp $tmp2 $tmp3";<br>$temp = $wynik;<br>$wynik = "$temp $tmp4 </a> </p>";<br>}<br><br>print "Body=$wynik";<br>?>


    when i run this php from a browser, it displays the right thing:

    Body=2005-02-28 Piekarnia only Qla // and so on.... like in the DB

    and Body is my Dynamictext Variable.
    In flash, i have this dynamic text filed that is converted to movieclip with an action

    Code: [Select]

    onClipEvent (load) {
    loadVariables ( "http://www.wizuale.pl/index.php" , this , "GET") ;
    }

    I still can't get any result in flash. It stays empty.
    THe strage thing is that even if i print (in php) just a simple word, like:
    print "Body=work god damn!"; It is only displayed in a browser but not imported to flash.
    the flash side seams to be ok, because it imports all txt written variables.
    Reasuming:
    my flash loads variable Body from a txt on serwer and displays it properly, but does not import
    the same variable from a php printing it.
    WHY?

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re:can't get variables from php to flash (!?)
    « Reply #1 on: 02/01/05, 16:43 »
    Hi Alek, welcome to the Boards !

    Using loadVariables you need to loop until data arrives, a more better approach is to use a LoadVars object. Check http://www.flash-db.com/Tutorials/loading/

    Jorge

    Musicman

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 2685
      • View Profile
      • Email
    Re:can't get variables from php to flash (!?)
    « Reply #2 on: 02/01/05, 16:48 »
    Hi,

    would you mide to post url of your movie?

    Musicman

    alek

    • Server what's that
    • *
    • Posts: 5
      • View Profile
      • Email
    Re:can't get variables from php to flash (!?)
    « Reply #3 on: 02/01/05, 16:52 »
    sure, u can DL the movie from http://www.wizuale.pl/pinfo.fla


    I am no good with object programing, and i really want to make a simple import
    action. I will use LoadVars if I learn how to do that.

    alek

    • Server what's that
    • *
    • Posts: 5
      • View Profile
      • Email
    Re:can't get variables from php to flash (!?)
    « Reply #4 on: 02/01/05, 16:54 »
    on the same server there are:
    www.wizuale.pl/index.php - prints the Body=blablablablba
    and
    www.wizuale.pl/huj.txt - holds the Body=blablablablabla

    txt works, but php don't :(

    Musicman

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 2685
      • View Profile
      • Email
    Re:can't get variables from php to flash (!?)
    « Reply #5 on: 02/01/05, 17:06 »
    Hi,

    I was looking for the swf on yrour server, not for the fla

    Musicman

    alek

    • Server what's that
    • *
    • Posts: 5
      • View Profile
      • Email
    Re:can't get variables from php to flash (!?)
    « Reply #6 on: 02/01/05, 17:12 »
    swf is on my computer. It's not on the server only the php is. Should swf and php be on the same server? there is a link in loadvariables so i figured out it doesn't matter.
    ??!!

    alek

    • Server what's that
    • *
    • Posts: 5
      • View Profile
      • Email
    Re:can't get variables from php to flash (!?)
    « Reply #7 on: 02/01/05, 17:14 »
    ok. i uploaded the swf
    link is http://www.wizuale.pl/pinfo.swf
    please help....

    Musicman

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 2685
      • View Profile
      • Email
    Re:can't get variables from php to flash (!?)
    « Reply #8 on: 02/02/05, 03:16 »
    Hi,

    probably all you need to do is change the php so it  does
    print "&Body=$wymik";

    Musicman

    yah

    • Server what's that
    • *
    • Posts: 9
      • View Profile
      • owenmundy.com
      • Email
    Re:can't get variables from php to flash (!?)
    « Reply #9 on: 02/11/05, 10:10 »

    Hi,

    probably all you need to do is change the php so it  does
    print "&Body=$wymik";

    Musicman



    And maybe add an ampersand to the end too...

    print "&Body=$wymik&";