Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/68.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_Mysql_Actionscript 3_Flash - Fatal编程技术网

as3和php变量问题

as3和php变量问题,php,mysql,actionscript-3,flash,Php,Mysql,Actionscript 3,Flash,我有一个MySQL数据库,我通过PHP脚本访问它。我遇到的问题是,从PHP返回的变量总是相同的。 我第一次在数据库中运行代码add/remove记录时,一切都是正确的,但是如果我再次运行它,add/remove PHP会向AS3报告与以前相同的记录。直接在浏览器中运行php返回的结果是正确的。 希望有人能帮我。。。我快疯了! 这是我的密码: AS3 PHP:send_data.PHP PHP get_data.PHP 当您从ActionScript调用响应时,它似乎正在被缓存。您可以在URL的末

我有一个MySQL数据库,我通过PHP脚本访问它。我遇到的问题是,从PHP返回的变量总是相同的。 我第一次在数据库中运行代码add/remove记录时,一切都是正确的,但是如果我再次运行它,add/remove PHP会向AS3报告与以前相同的记录。直接在浏览器中运行php返回的结果是正确的。 希望有人能帮我。。。我快疯了! 这是我的密码:

AS3

PHP:send_data.PHP

PHP get_data.PHP


当您从ActionScript调用响应时,它似乎正在被缓存。您可以在URL的末尾添加一个微时间值,这将阻止缓存

var phpUrl:String = "get_data.php?" + new Date().getTime();

我尝试了此操作,但得到一个错误:“打开URL时出错错误2044:未处理的ioError:”。text=错误2032:流错误。URL:at db_fla::main timeline/sendSqlData[C:\Users\andrei\Desktop\ddp\u listen back prj\uuuu new\u db\php.as:62]'。尝试在phpUrlRequest中添加此timstamp,但我的行为与以前相同。您是否错过了?php之后?在这一行之后,尝试执行TracePhurl并查看控制台显示的内容?包含在parseMe变量中:“var parseMe:String=?parseMe=cameFromFlash&boohoo=+new Date.getTime+&;”。这是get_data.php url中的控制台输出“”,在您的最后一条评论中,您的结尾似乎有一个“不应该出现的”。现在我看到时间戳是相同的,无论我在调用之间等待多长时间。。。为什么?
<?php
include_once ('connect.php');

$playlistDateString = trim($_GET['playlistDateString']);
$playlistSongNr = trim($_GET['playlistSongNr']);
$songTime = trim($_GET['songTime']);

if($connection)
{
    $status .= ("connect=ok&");

    //Select database
    mysql_select_db($dbname, $connection);

    $sql="INSERT INTO $tablename1 (ID, playlistDate, playlistSongNr, songTime, comment) VALUES ('', '$playlistDateString', '$playlistSongNr', '$songTime', 'comment');";
    $status .= ("sql=".$sql."&");

    // Execute query
    if (mysql_query($sql,$connection) )
    {
        $status .= ("query=ok");
    }
    else
    {
        $status .= ("query=error:".mysql_error());
    }
}
else
{
    $status = ("connect=error: ".mysql_error());
}

echo $status;
mysql_close($connection);
?>
<?php

include_once ('connect.php');

if($connection)
{
    $status .= ("connect=ok");
    //Select database
    mysql_select_db($dbname, $connection);
    //Execute query
    $query = mysql_query("SELECT * FROM $tablename1");

    if ($query)
    {
        $result = "records=".(mysql_num_rows($query));
        $i = 0;
        while ($row = mysql_fetch_array($query))
        {
            $result .= "&id".$i."=".($row["ID"]);
            $result .= "&playlistDate".$i."=".($row["playlistDate"]);
            $result .= "&playlistSongNr".$i."=".($row["playlistSongNr"]);
            $result .= "&songTime".$i."=".($row["songTime"]);
            $result .= "&comment".$i."='".($row["comment"])."'";
            $i++;
        }
        $status .= ("&receive=ok");
        echo $result."&";
    }
    else
    {
        $status .= ("&receive=error");
    }
}
else
{
    $status .= ("connect=error:".mysql_error());
}
echo $status;

mysql_close($connection);
?>
var phpUrl:String = "get_data.php?" + new Date().getTime();