Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/270.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
As3+PHP错误_Php_Actionscript 3 - Fatal编程技术网

As3+PHP错误

As3+PHP错误,php,actionscript-3,Php,Actionscript 3,我使用as3 votingpoll获取此错误。 我不明白怎么了,因为我只知道基本的编码。 我真的需要让它为学校的项目工作 希望任何人都能帮助我! 非常感谢 TypeError: Error #2007: Parameter text must be non-null. at flash.text::TextField/set text() at Onlinepoll_fla::WholePoll_1/completeHandler() at flash.events::EventDispatch

我使用as3 votingpoll获取此错误。 我不明白怎么了,因为我只知道基本的编码。 我真的需要让它为学校的项目工作

希望任何人都能帮助我! 非常感谢

TypeError: Error #2007: Parameter text must be non-null.
at flash.text::TextField/set text()
at Onlinepoll_fla::WholePoll_1/completeHandler()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
AS3代码请求:

PHP代码:


显然,event.target.data.return\u msg或event.target.data.choice1Count等变量为空

首先检查PHP脚本是否回显了正确的响应$my_msg或$choice1Count也可能为空。如果PHP脚本正常,请尝试在completeHandler方法中跟踪这些值:

trace("message : " + event.target.data.return_msg);
trace("choice1Count : " + event.target.data.choice1Count);

谢谢你注意到有人能帮忙吗?
<?php
/* 
::::::::::Script Written By: Adam Khoury @ www.developphp.com:::::::::::::
:::::::::If you find www.developphp.com tutorials helpful or handy:::::::::::::
:::::::::::please link to it wherever possible to help others find it::::::::::::::::
*/
// ---------------------------------------- Section 1 -----------------------------------------------
//  IMPORTANT!!!! Connect to MySQL database here(put your connection data here)
mysql_connect("localhost","root","") or die (mysql_error());
mysql_select_db("data") or die (mysql_error());

// When Flash requests the totals initially we run this code
if ($_POST['myRequest'] == "load_numbers") {

    // Query the totals from the database
    $sql1 = mysql_query("SELECT id FROM votingPoll WHERE choice='1'"); 
    $choice1Count = mysql_num_rows($sql1); 
    $sql2 = mysql_query("SELECT id FROM votingPoll WHERE choice='2'"); 
    $choice2Count = mysql_num_rows($sql2); 
    $sql3 = mysql_query("SELECT id FROM votingPoll WHERE choice='3'"); 
    $choice3Count = mysql_num_rows($sql3); 

    echo "choice1Count=$choice1Count";
    echo "&choice2Count=$choice2Count";
    echo "&choice3Count=$choice3Count";

}

// ---------------------------------------- Section 2 -----------------------------------------------
// IF POSTING A USER'S CHOICE
if ($_POST['myRequest'] == "store_choice") {

    //Obtain user IP address 
    $ip = $_SERVER['REMOTE_ADDR'];
    // Create local variable from the Flash ActionScript posted variable
    $userChoice   = $_POST['userChoice'];
    $sql = mysql_query("SELECT id FROM votingPoll WHERE ipaddress='$ip'");
    $rowCount = mysql_num_rows($sql);
    if ($rowCount == 1) {

        $my_msg = "You have already voted in this poll.";
        print "return_msg=$my_msg";

    } else {

        $sql_insert = mysql_query("INSERT INTO votingPoll (choice, ipaddress) VALUES('$userChoice','$ip')")  or die (mysql_error());
        $sql1 = mysql_query("SELECT * FROM votingPoll WHERE choice='1'");
        $choice1Count = mysql_num_rows($sql1);
        $sql2 = mysql_query("SELECT * FROM votingPoll WHERE choice='2'");
        $choice2Count = mysql_num_rows($sql2);
        $sql3 = mysql_query("SELECT * FROM votingPoll WHERE choice='3'");
        $choice3Count = mysql_num_rows($sql3);
        $my_msg = "Thanks for voting!";
        echo "return_msg=$my_msg";
        echo "&choice1Count=$choice1Count";
        echo "&choice2Count=$choice2Count";
        echo "&choice3Count=$choice3Count";
    }
}
?>
trace("message : " + event.target.data.return_msg);
trace("choice1Count : " + event.target.data.choice1Count);