A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: xml and php

  1. #1
    Member
    Join Date
    Apr 2004
    Location
    Milton Keynes
    Posts
    85

    xml and php

    Hi

    I have a php script that I have been experimenting with it is sent two variables from flash which are queryed to see if they exist inside in a mysql database giving on message if they exist and another if they dont.

    The message is printed in XML which all works fine but how can I get to the XML with flash after the the variables have been sent to the php script.

    Both files are below.

    Thanks for any help.

    ++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++

    PHP File

    <?php
    include "config.php";
    mysql_connect("*******","****","*****");
    mysql_select_db("mydata");

    $username = $_POST['username'];
    $pass = $_POST['pass'];

    $result = mysql_query("SELECT * FROM login WHERE username = '$username'

    AND password = '$pass'") or die(mysql_error());
    $num = mysql_num_rows($result);

    if($num > 0 ){
    echo"<?xml version=\"1.0\"?>\n";
    echo"<products>\n";
    echo "<item> You are Logged in </item>\n";
    echo"</products>";
    }
    else {
    echo"<?xml version=\"1.0\"?>\n";
    echo"<products>\n";
    echo "<item> You are not Logged in </item>\n";
    echo"</products>";
    }

    ?>

    ++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++

    Flash

    enter_btn.onRelease = function() {
    if (!username || !pass) {
    message.text = "Please Enter All Information";


    } else {
    varsToSend = new LoadVars();
    varsToSend.username = username;
    varsToSend.pass = pass;
    varsToSend.onLoad = function(success) {
    if (success) {
    _root.message.text = this.msg;
    if (this.login) {
    // ok, you're logged.. go to the page for
    // registered users
    }
    } else {
    trace("Error reading the php page");
    }
    };
    varsToSend.sendAndLoad("login.php", varsToSend, "POST");
    }
    };

  2. #2
    Junior Member
    Join Date
    Jul 2003
    Location
    Newton, MA, USA
    Posts
    12
    I have a similar problem.

    I created an Flash app. that saves some data to a db. Some of the fileds are xml files with info about positon and angles of objects on the flash movie that don't deserve to be saved as individual variables on the db.

    When runing the php script on the broeser I get the results correctly. However, when loading into Flash via loadVars, the variable that has the content of the field with xml stuff comes empty.

    I copies the result from the browser to a text file and loaded that text file and everything worked fine. So, I am clueless on why the variable with the xml content is not recognized by Flash when served from a db?


    Any suggestions?

    Gilbert
    Gilbert Mizrahi

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center