douliao1911 2014-08-31 14:59
浏览 73
已采纳

Flash AS2不会从mySQL数据库加载数据! (使用PhP,AS2和MySQL)

I have a problem! Flash CS6 (AS2) won't load up data from mySQL database. It does successfuly send data from flash to phpmyadmin but flash doesn't load it up D:. I need help please! So the problem is that whenever I test the movie it traces undefined for the variable I want to load from mySQL. Everything is on one frame including the code and textboxes, buttons, etc. Here is my code:

PHP

<?php
require_once('/home/a6934122/public_html/AccountSystem/dbconnect.php');
$testdata1= $_GET['testdata1'];
$testdata2 = $_GET['testdata2'];
$user = $_GET['user'];


$result = mysql_query("SELECT * FROM accounts WHERE user = '$user'");
$result2 = mysql_query("SELECT * FROM accounts WHERE testdata1 = '$testdata1'");


if(mysql_num_rows($result) == 0){
$status = "&Thestatus = PhP Failed.";
echo($status);
} else {
$row2 = mysql_fetch_array($result2);
$row = mysql_fetch_array($result);
$user=$row['user'];
$testdata1=$row2['testdata1'];


$status = "&Thestatus = PhP Successful.";
mysql_query("UPDATE accounts SET testdata1='$testdata1', testdata2='$testdata2' WHERE user='$user'");
echo($status);
}
?>

FLASH AS2

stop();
//Result SendData Code
var result_lv:LoadVars = new LoadVars();
result_lv.onLoad = function(success:Boolean) {
    if (success) {
        result_ta.text = "We are in business.";
    } else {
        result_ta.text = "Error connecting to server.";
    }
}
//Result SendData Code
//Sending Account Data
SendData = new LoadVars();
//Register Account
register = new LoadVars();
registered = new LoadVars();
//Login Account
login = new LoadVars();
logged = new LoadVars();
//Send Datas
SendData.user = user
submitURL = "http://lumosityentertainment.hostei.com/AccountSystem/PhpLoadTest.php";
  SendData.testdata1 = testdata1;
  SendData.testdata2 = "Testing";
trace(SendData.testdata1);
//now the magic
  SendData.sendAndLoad(submitURL, result_lv, "GET");
  • 写回答

1条回答 默认 最新

  • douyan8267 2014-09-01 05:12
    关注

    the standard way to load variables is to write so onload event for the loadvars object

    try this:

    var result_lv:LoadVars = new LoadVars();
    SendData.user = user;
    submitURL = "http://lumosityentertainment.hostei.com/AccountSystem/PhpLoadTest.php";
    result_lv.testdata1 = testdata1;
    result_lv.testdata2 = "Testing";
    result_lv.onLoad = function(success:Boolean) {
        if (success) {
            result_ta.text = "We are in business.";
        } else {
            result_ta.text = "Error connecting to server.";
        }
    
    }
    result_lv.sendAndLoad(submitURL, result_lv, "GET");
    

    you can find useful information here : loadvar as2 help

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 LiBeAs的带隙等于0.997eV,计算阴离子的N和P
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 来真人,不要ai!matlab有关常微分方程的问题求解决,
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算