MySQL、PhP和Flash As3数据加载不正确


MySQL,PhP, and Flash As3 Data is not loading properly?

由于某些原因,PHP变量加载非常不正确。这就是发生的事情:

在我的PHP代码中,我有:

<?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代码中我有:

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就会显示undefined

但是result_text2.text会说:HELLOtheuserbio=this is the user bio

基本上发生的是result_text2同时说theuserbiothetesting。而CCD_ 8在说CCD_。

如何使result_text表示theuserbio内部的数据,而result_text2表示thetesting内部的数据?

在打印之间添加符号

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

检查你是否有这条线:

urlloader.dataFormat = URLLoaderDataFormat.VARIABLES;