本文介绍了MySQL和PHP和Flash AS3的数据不正确加载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于某些原因,PHP变量装载非常不正常。因此,这是发生了什么:

For some reason the PHP variables are loading very improperly. So this is what happens:

在我的PHP code,我有:

In my PHP code I have:

<?php
include_once "connect.php";

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

if ($_POST['systemCall'] == "checkLogin") {

    $sql = "SELECT * FROM users WHERE username='$username' AND password='$password'";

    $query = mysql_query($sql);

    $login_counter = mysql_num_rows($query);

    if ($login_counter > 0) {
        while ($data = mysql_fetch_array($query)) {

            $testing = $data["testing"];
            $userbio = $data["user_bio"];

            print "thetesting=$testing";
            print "theuserbio=$userbio";
        }
    } else {
        print "theuserbio=The login details dont match our records.";
    }
}
?>

然后在我的AS3 code,我有:

Then in my AS3 Code I have:

import flash.text.*;


result_text.autoSize = TextFieldAutoSize.LEFT;

result_text.text = "" + event.target.data.theuserbio;
result_text2.text = "" + event.target.data.thetesting

什么情况是,每当我登录使用正确的凭据 result_text.text 会说未定义

result_text2.text 会说: HELLOtheuserbio =这是用户的生物

基本上什么情况是, result_text2 是说这两个 theuserbio thetesting 。虽然 result_text 是说未定义

Basically whats happening is that the result_text2 is saying both theuserbio and thetesting. While result_text is saying undefined.

我如何让这个 result_text 表示,在 theuserbio 中的数据,而 result_text2 表示,在 thetesting

How do I make it so that result_text says the data inside theuserbio, and result_text2 says the data inside thetesting?

推荐答案

添加打印的符号

print "thetesting=$testing";
print "&";
print "theuserbio=$userbio";

和检查你有这样一行:

urlloader.dataFormat = URLLoaderDataFormat.VARIABLES;

这篇关于MySQL和PHP和Flash AS3的数据不正确加载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 20:22