undefined resutl tryng to get data from flash with php

Hello

I'm not a coder, but I understand the way that it work and can handle already-written script. I'm going through with a problem that I do not understand why is happening. I have a php and AS3 to get results from the database. Php works fine since I test. but demand for the Flash gives me a result "undefined". I have a text box on the flash file in which is supposed to show the results of the php. So far, this code:

AS3:

import flash.display.*;
import flash.events.*;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.net.URLVariables;
import flash.net.URLLoaderDataFormat;
import flash.net.URLRequestMethod;


    
// Assign a variable name for our URLVariables object
var variables:URLVariables = new URLVariables();
//  Build the varSend variable
var request:URLRequest = new URLRequest();
request.url = "ckBxSample_disp.php";
request.method = URLRequestMethod.POST;
request.data = variables;
// Build the varLoader variable
var varLoader:URLLoader = new URLLoader();
varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
varLoader.addEventListener(Event.COMPLETE, completeHandler);
try
{
    
    varLoader.load(request);
}
catch (error:Error)
{
    trace("Unable to load URL");
}
// Handler for PHP script completion and return
      function completeHandler(event:Event):void{
       // Load the response from the PHP file
      if (event.target.data.returnBody == "") {
        output_txt.text = "No data coming through";
      } else {
        output_txt.condenseWhite = true;
        output_txt.htmlText = "" + event.target.data.returnBody;
        
      }
    
    }

// Send the data to the php file
varLoader.load(request);
// Ready the variables for sending
variables.requester = "phpRows";

in php:



If ($_POST ['applicant'] == 'phpRows') {}

SQL connection code

then mysql query here

$sql = mysql_query ("SELECT blah blah blah

then the while loop for all records, I like to shoot

While ($Row = blah) {}

call lines

$id = $row ['id'];

sending the results of th calle by flash

$body = "$id";

}

Flash results

Print "returnBody = $body";

Close con

mysql_close();

Exit();

}

It is most of the code and I get a result that is not defined in the text box in flash

can anyone help? Please

Thanks in advance

PHP is badly formatted.  use:

<>

I have remove the requirement to show the result of the database

application of Flash

($_POST ['applicant'] == 'phpRows');

Connect to the databese

include_once 'connect_to_mysql.php '.

$tbl_name = 'table_name ';

$body = "";

$con = mysql_connect ($mysql_hostname, $mysql_user, $mysql_password)

or die ("Opps Fail to connect to the host");

@mysql_select_db ($mysql_database, $con) or die ("Opps fail to connect to database");

$sql = mysql_query ("SELECT * FROM $tbl_name");

$result = mysql_query ($sql);

While ($row = {mysql_fetch_array ($sql))}

$id = $row ['id'];

$uname = $row ['uname'];

$client_song = $row ["client_song"];

$body = "$id & $uname & $client_song;

}

Print $body;

mysql_close();

Exit();

?>

Tags: Adobe Animate

Similar Questions

  • Getting data from tree with a twist

    I just started playing Flex and am excited by the possibilities. I read the previous question and the answers given tree obtain by a HTTPService, but can't make it work with my xml data. I have an xml file that does not have tags of regular node for the tree dataprovider. I was wondering if there was a way to get a tree to be filled with data using several names of tags and descriptions enclosed in these tags. Here's an example of my xml data to show you what I mean:

    <? XML version = "1.0" encoding = "utf-8"? >

    <>Catalog

    < product = "Nokia" >
    < name > Nokia 6010 < / name >
    < description > easy to use without sacrificing style, the Nokia 6010 phone offers communication functional voice taken in charge by text messaging, e-mail, multimedia, internet mobile, games and more < / description >
    < price > 99.99 < / price >
    < / product >

    < product = "Nokia" >
    Nokia 3100 blue < name > < / name >
    < description > cover light up the night with a glow-in-the-dark - when he charged with light you can easily find your phone in the dark. When you receive a call, the Nokia 3100 phone flashes in harmony with your ringtone. And when you take on a Nokia Xpress - on™ game cover *, you will get the luminescent light effects in time to the game action. < / description >
    < price > 139 < / price >
    < / product >
    < / catalogue >

    Using these data, I expect to have a folder called "Nokia", which has two files called 'Nokia 3100 blue' and 'Nokia 6010'.

    So I searched the internet to see if I could get this xml format to work with a tree and this is the code I have so far:

    <? XML version = "1.0" encoding = "utf-8"? >
    "" < mx:Application xmlns:mx = ' http://www.adobe.com/2006/mxml ' layout = "horizontal".
    creationComplete = "treeXML.send (); ">

    < mx:Script >
    <! [CDATA]
    public void fixLabel(item:Object):String {}
    var node: XML = XML (item);
    If (node.localName () == 'product')
    Return unescape (node.@product);
    Else if (node.localName () == "name")
    Return unescape (node.@name);
    on the other
    return ";
    }
    []] >
    < / mx:Script >

    < mx:HTTPService id = "treeXML" url = "" data / catalog.xml "resultFormat ="e4x"/ >"


    < mx:Panel width = "30%" height = "100 percent" layout = "horizontal" >
    < mx:Tree width = '100% ' showRoot = "true" horizontalScrollPolicy = 'auto '.
    Height = "100%" id = "mytree" dataProvider = "{treeXML.lastResult.node}" "
    labelFunction labelField="@name" = "fixLabel" / >

    < / mx:Panel >

    < mx:Panel width = "70%" height = "100%" id = "panel1" layout = "horizontal" >
    < / mx:Panel >

    < / mx:Application >


    However, nothing is filled in the tree. Can someone help me with this please. I think that this problem has been solved before but I don't know where to look.

    Thank you for your help.

    Oopps and another comment.

    Loading external data in Flash (Flex) is the asynchronous process.
    You should read the data loading from an external source in the (result) event handler and assign it to the variable of data tree provider here

    See slightly modified code in your example below:


    http://www.Adobe.com/2006/mxml"layout ="horizontal"creationComplete =" onCreationComplete () ">"


    Import mx.rpc.events.ResultEvent;
    Import mx.collections.XMLListCollection;

    [Bindable]
    private var myXMLData: XMLListCollection;

    protected function onCreationComplete(): void {}
    treeXML.send ();

    }

    protected void onDataFetched(evt: ResultEvent): void {}
    var dataXML: XML = XML (evt.result);
    myXMLData = new XMLListCollection (new XMLList (dataXML.children ()));
    }

    public void fixLabel(item:Object):String {}

    var node: XML = XML (item);
    If (node.localName () == 'product')
    Return unescape (node.@product);
    Else if (node.localName () == "name")
    Return unescape (node.@name);
    on the other
    return ";
    }
    ]]>



    Height = "100%" id = "mytree" dataProvider = "{myXMLData}".
    labelFunction labelField="@name" = "fixLabel" / >


  • How to get data from excel

    Hello world

    How can I get data from excel inside my program? I'm using labview 8.2. I have tried to find the solution for this but seems that the solutions are not suitable. Can someone help me? Thank you.

    Hi jieah,

    Inside of the attachment nijams don't you see this?

    read_excel_values. LLB

  • Y510 unable to get data from the camera.

    Hello

    I have a Y510 with Windows Vista 32 bit, 3 GB RAM, only 5 weeks. I get this message when I try to use Veriface, "unable to get data from the camera. The camera may have been disconnected or busy. I reinstalled Vista of the State in which the laptop came, but it does not work. I also updated the bios and install other updates were available. I would appreciate any advice.

    Thank you

    Peter

    I wish it was as easy as press Fn + Esc, I looked through an another Y510 our office and managed to find a process that must be set to Auto, the process is KtmRm. This process cannot be disabled, handicapped, or on a time delay, it must be AUTOMATIC.

  • Get data from a member of the region partitioned customer

    Hello

    I have a partitioned area, this region is in all 3 members, is it possible to get data from this region but only from 1 member of the customer, if so how?

    What is your definition of the region on the server? The three members have given? You set redundant copies? In addition, if the optimizeForWrite() of the service method returns false, the function will run the smallest number of nodes.

    Follow these steps:

    The redundant copies of the value = 1

    Returns true for optimizeForWrite()

    Make sure that all members contain primary buckets

    Perform function like you do above

    Barry

  • Get data from a dBASE - .dbf.

    Hello everyone - Hello work Sunday: (.) I need to get data from legacy applications that run the dbase program. You'll need to auto data. If you have an idea, please tell me. Thanks to you, NIC.

    >

    Hello everyone - Hello work Sunday: (.)

    I do not work yet--it's sad that :)

    I need to get the data from the old application
    running the program dbase. You'll need to auto data. If you have an idea, please
    say to me.

    Have a look here http://asktom.oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:711825134415.

    It worked for me, with a bit of difficulty – mainly because of my own stupidity... If you have
    no problem, post back.

    HTH,

    Paul...

    Thanks to you, NIC.

  • How can I get data from each associated XMLnode in movieclips separated when you click a line in the combobox

    How can I get data from each associated XMLnode in movieclips separated when you click a line in the combobox?

    A sample of XML is like this:

    <>planter

    < Lauvtre >

    < Botanisk_navn > Acer campestre < / Botanisk_navn >

    < Norsk_navn > Naverlonn < / Norsk_navn >

    Gronn < Farge > < / fan >

    H4 < Herdighet > < / Herdighet >

    < Hoyde > 10-15 m < / Hoyde >

    < / Lauvtre >

    I have a combobox where it shows the botanical name and the Norwegian name. But the rest of the info in movieclips seem separate.

    Someone has an idea how to do this? Can I use the trace function maybe? Here is my AS3 code so far:

    var loader: URLLoader = new URLLoader();

    loader.addEventListener (Event.COMPLETE, onLoaded);

    list.addEventListener (Event.CHANGE, itemChange);

    function itemChange(e:Event):void

    {

    your. Text = list.selectedItem.data;

    TB. Text = list.selectedItem.label;

    }

    var xml;

    function onLoaded(e:Event):void

    {

    XML = new XML (e.target.data);

    var it: XMLList = xml. Planter.Lauvtre;

    for (var i: uint = 0; i < il.length (); i ++)

    {

    list.addItem ({data: it.}) Farge.Text ([i]) + "\n"+ it.» Herdighet.Text ([i]) + "\n" + it. Hoyde.text ([i]),

    label: it. Botanisk_navn. Text() [i] + "\n"+ it.» Norsk_navn. Text() [i]});

    }

    }

    Loader.Load (new URLRequest ("lauvtre.xml"));

    Thank you!

    Rheus.

    I don't know what you're trying to do.  but, if you want to fill one combobox with the botanical names and when one is chosen, the other use of logins:

    var loader: URLLoader = new URLLoader();

    loader.addEventListener (Event.COMPLETE, onLoaded);

    list.addEventListener (Event.CHANGE, itemChange);

    function itemChange(e:Event):void {}

    var selectedObj:Object = a [list.selectedIndex]

    trace (selectedObj ['fan'], selectedObj ['Botanisk'], etc);

    }

    var xml;

    var a: Array = [];

    function onLoaded(e:Event):void {}

    XML = new XML (e.target.data);

    var it: XMLList = xml. Lauvtre;

    for (var i: uint = 0; i

    list.addItem({label:il[i].child('Botanisk_navn').toString()});)

    a [i] = {'Fan': it [i].child('Farge').toString (), 'Herdighet': it [i].child('Herdighet').toString (), "Hoyde": he [i].child('Hoyde').toString (), 'Botanisk':il[i].child('Botanisk_navn').toString(),'Norsk_navn':il[i].child('Norsk_navn').toString()};}

    }

    }

    Loader.Load (new URLRequest ("test.xml"));

  • How to get data from one or several times of perticuler dates

    (1) how can we get data from one or more dates perticuler.
    for example. date of 01/01/2011 and time is 00:00:00 to 23:59:59

    and

    (2) how can we get data from one or more dates perticuler.
    from date 01/01/2011 to 01/02/2011 date and time e.g. is from 00:00:00 to 23:59:59.

    can we?

    Hello

    Use a WHERE clause to include only certain lines.
    For example:

    SELECT     *
    FROM     table_x
    WHERE     dt     BETWEEN TO_DATE ( '01/01/2011 00:00:00'
                        , 'DD/MM/YYYY HH24:MI:SS'
                        )
              AND     TO_DATE ( '01/01/2011 23:59:59'
                        , 'DD/MM/YYYY HH24:MI:SS'
                        )
    ;
    

    In this example, the first date (before the keyword AND) and second (after the keyword AND) lie on the same calendar day. It's just a coincidence, they can be on different dates.
    The first date must not be later than the date of the second; If this is the case, you will get 0 found lines.

    I hope that answers your question.
    If not, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all tables and also post the results desired from these data.
    Explain, using specific examples, how you get these results from these data.
    Always tell what version of Oracle you are using.

  • getting data from two servers?

    Experts-

    We have two servers for the storage of the tables. 1 history 1. current server Prod

    We have same tables in the databases server.

    All the info before one month from the date of the day are stored in database tables history server
    and the rest in database tables current prod server.


    I create reports such as when the user enters a date, OBIEE must check if the date is in a month (30 days) the date today or earlier at 30 days, on this basis, it must get data from historical Server database tables / running production database server.

    How can I implement this?

    I need to create two clusters of connction (RPD records) and develop the same model twice? (One for the historical paintings and one for prod tables?)
    or can I use the technique of fragmentation? If so, can you give me an idea hwow to implement the Fragmentation of this requirement?

    Thank you for your help in advance

    You must use the fragmentation of this requirement. It is not difficult once you understand the basic principle. Nico article read here for details:

    http://gerardnico.com/wiki/dat/OBIEE/fragmentation_content

    The only non-standard bit for you will be to define the criteria of fragmentation on your sources of logical table. This is the part that says BI server to hit source.

    After return here if you get stuck.

    Paul

  • Send variables from flash to PHP

    Hello world
    I have a problem when sending variables from flash to PHP
    Here is the code:

    submit.onPress = function)
    {
    c = new LoadVars ();
    c.NME = "Myname"
    c.sendAndLoad ("getVars.php", reply, 'POST');
    }

    PHP code:

    <? PHP
    $name = $_POST ['nme'];
    Print 'your name is. " $name. «. < br / > ';
    ? >

    What I'm doing wrong here.
    I get an error message saying notice: Undefined index: name in \xxx\getVars.php on line 2

    Please help me. Thanks in advance

    2 things that I notice immediately

    1. you never initialize the variable 'Reply' to your sendAndLoad.
    2. you must pass a string encoded in URL variables which is ampersand delimited. Usually the returned string would look like echo ("" & result = 1 & msg = your % 20name % 20is %20 '. ") $name. ». 3rd % 3Cbr % &");

    Your mistake is that the information is not get passed correctly. I usually use $_REQUEST communication flash-php, although this should not make a difference. I've seen people use $_REQUEST for testing purposes and will then to $_POST when finished.

  • Phone is dead. Is it possible to get data from internal HD?

    Unfortunately, I've never configured all backups (I know not. I don't know.) I was wondering if there is a way to recover data from internal storage to a phone. Used to power the device on. In him plugging shows the green light at the top, but the screen is black. Connect the phone to my computer does not lead to a result on the computer (not on a device connected). Phone is useful, dead to the world.

    Will I need to use a data recovery service, or are there other options available?

    See the green light means that there is not enough power in the battery to start the phone. The energy needs of cord must be connected for about 30 to 60 minutes. After that, then try to start the phone. If the green light turns off, then try to start it as well.

    If you cannot start the phone so there is no available recovery option that I know. We will work to try to get the phone to boot. Fingers crossed for you. I hope this helps.

  • Does anyone know how to get data from a web service of Labview with ajax or JSON?

    Hello

    I try to use ajax and json to service Web restful which I build with the labview. However I get errors

    For example. I create a web service from a labview vi (z = x / y http://localhost: 8080/math/divide/5/20 will give {Z: "4,000,000"})

    I get errors for the attached html files.

    Does anyone know how to get al labview WebService with ajax or json data?

    Thank you... Eran


  • Getting data from the nodes of event data

    Hi all

    I have a while loop with a Structure of the event and a Structure of case inside. The Structure of the event a lot of cases, and each of them is controlled by a different object (buttons, sliders, graphics, etc.). Sometimes, I have to use data from the nodes of event data to power a Business Structure that works like a State Machine in my code. To clean the block diagram, I want to 'export' data nodes using a single wire event data, but this is not possible because there is a conflict of data, since I get data of CtlRef in one case and Coords in others (for example).

    To resolve this problem, I'm feeding a beam to create a cluster and feed it to the box Structure data. However, the process is so painful, because I have to feed the Bundle function with constants of all sorts of data connected to him.

    Find attached an example. It is not the actual code but shows what I have to do.

    Thank you

    Dan07

    Why you do not pass a Variant to the structure of the case. In your case case simply make a variant of the appropriate data that you want to pass. I guess the case appropriate business structure will be to get called for the event. Given that you need to know the data type this case awaits can use the variant data VI and now you have the data you want.

  • How to get data from an Excel file exist using report generation tools

    I try to use the Excel vi get the data of the report generation tool, but I can't understand how to activate a path can be explored in the right type for the VI.  I tried to use the new Report.vi, but this does not work unless you use a template.  It will not open an existing excel file and make an open report to extract data from.

    Essentially, I have a bunch of excel files that have data in them, and I want a VI allows to analyze the data.  I'm going to pull in all the data directly from the excel file so I don't have to reproscess them all in text so I can use the more standard datasheet live but to convert even the excel file programtically in labview I still need to be able to open the excel file and get the data?

    I found my problem.  It turns out that only not to have had a problem with the tool box new report vi.  I had accidentally wired an input control of path of folder instead of an input control of path of file to it.  Changing the file type took care of her and I was able to access excel files, I tried using the new report VI to extract the file, and Excel Get Data to extract the data.

  • Get data from an Essbase Cube with Jean BAPTISTE

    Hello

    I'm new on the subject of japi essbase and I need help.

    I try to get some data from an essbase cube. In Excel, I used the essbase add with the function 'esscell() '.

    Is there a way to do the same thing with the japi essbase?

    If you just want to export data to a text file, then it will be probably easier to look at the following options

    DATAEXPORT - DATAEXPORT

    Script report - report writer commands

    MDX - MDX

    See you soon

    John

Maybe you are looking for