Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/66.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
Flash,PHP MySQL…我可以';似乎无法检索多列数据_Php_Mysql_Flash_Adobe - Fatal编程技术网

Flash,PHP MySQL…我可以';似乎无法检索多列数据

Flash,PHP MySQL…我可以';似乎无法检索多列数据,php,mysql,flash,adobe,Php,Mysql,Flash,Adobe,我正在同时学习Flash、PHP和MySQL,当然这已经成为一个问题。通过教程和从头开始的代码构建,我已经能够让我定制的Flash应用程序从MySQl数据库中获取一段数据。以下是动作脚本: gobtn.addEventListener(MouseEvent.CLICK, srchPeople); function srchPeople(e:MouseEvent):void { // Assign a variable name for our URLVariables object var

我正在同时学习Flash、PHP和MySQL,当然这已经成为一个问题。通过教程和从头开始的代码构建,我已经能够让我定制的Flash应用程序从MySQl数据库中获取一段数据。以下是动作脚本:

gobtn.addEventListener(MouseEvent.CLICK, srchPeople);

function srchPeople(e:MouseEvent):void
{

// Assign a variable name for our URLVariables object
var variables:URLVariables = new URLVariables();

// Build the varSend variable
// Be sure you place the proper location reference to your PHP config file here
var varSend:URLRequest = new URLRequest("http://www.myhost.com/my_php.php");
varSend.method = URLRequestMethod.POST;
varSend.data = variables;

// Build the varLoader variable
var varLoader:URLLoader = new URLLoader;
varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
varLoader.addEventListener(Event.COMPLETE, completeHandler);

variables.txtBox = txtBox.text;
variables.sendRequest = "parse";

// Send the data to the php file
varLoader.load(varSend);

// When the data comes back from PHP we display it here     
function completeHandler(event:Event):void
{   
    var phpVar1 = event.target.data.var1;
    //var phpVar2 = event.target.data.var2;

    testBox.text = phpVar1;
    testBox.alpha = 87;
    testBox.autoSize ="left";
    modalBox.alpha = 57;

    modalBox.height = testBox.height + 30;
    modalBox.width = testBox.width + 30;
}
}
ActionScript中的所有内容都按照预期的方式执行。我将txtBox的内容发布到PHP,然后从MySQL数据库中获取,然后显示在testBox中……但只有一条信息。我已经用PHP和查询进行了数小时的实验,试图检索该行的多个信息列。我只调用一个变量,如PHP文件中所示:

<?php

mysql_connect("localhost", "mwh", "password"); 
mysql_select_db ("mydb");

// Only run this script if the sendRequest is from our flash application
if ($_POST['sendRequest'] == "parse") 
{
// Access the value of the dynamic text field variable sent from flash
$txtBox = mysql_real_escape_string($_POST['txtBox']);

$query = "SELECT fname FROM People WHERE fname='$txtBox'"; 

$result = mysql_query($query);
//$row = mysql_fetch_array($result)
$first_name = mysql_num_rows($result);

if ($first_name == 0)
    //echo "Name does not exist.";
    print "var1 = $result doesn't exist.";
else
{
        $result = mysql_result($result, 0);
                    /// I've tried using other variables
        print "var1=$result has been retrieved from the database.";

}   


}
mysql_close();
?> 

1。不要使用mysql函数。他们被弃用了。2.你很容易受到伤害。请勿使用此代码。谢谢。我会尽快修好的。对这个问题有什么建议吗?你会注意注射吗$txtBox=mysql\u real\u escape\u字符串($\u POST['txtBox']);更好,但您确实应该使用准备好的语句切换到mysqli或PDO。那你就不用(几乎)担心注射问题了。