[英]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
在說theuserbio
和thetesting
。 而result_text
說的是undefined
。
如何使result_text
表示theuserbio
內的數據,而result_text2
表示thetesting
內的數據呢?
在打印之間添加與號
print "thetesting=$testing";
print "&";
print "theuserbio=$userbio";
並檢查是否有以下行:
urlloader.dataFormat = URLLoaderDataFormat.VARIABLES;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.