Connecting flex with php(wamp)

i m trying to connect a flex application to a php (wamp server)..bt i m unable to do soo
ma application runs fine....bt wen i click submit button it shows ..transfering data frm localhost n nothing happens......database is nt updated........
//flex code
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="send_data()">
<mx:Script>
<![CDATA[
import mx.controls.DataGrid
private function send_data():void {
userRequest.send();
]]>
</mx:Script>
<mx:Label x="79" y="89" text="username"/>
<mx:Label x="79" y="128" text="rolnumber"/>
<mx:TextInput id="nm" x="153" y="87"/>
<mx:TextInput x="153" y="126" id="roll"/>
<mx:Button x="127" y="191" label="submit" id="sub" click="send_data()"/>
<mx:HTTPService id="userRequest" url="http://localhost/connect.php" useProxy="false" method="POST">
<mx:request xmlns="">
<username>{nm.text}</username><rollnumber>{roll.text}</rollnumber>
</mx:request>
</mx:HTTPService>
</mx:Application>
//php code
<?php
mysql_connect("localhost", "root", "") or die("cannot connect");
mysql_select_db("std_db") or die("cannot select database");
$q="INSERT INTO `std_db`.`student` (`name` ,`roll`)VALUES ( '$_POST[nm]', $_POST[roll])";
if(mysql_query($q))
echo "sucessfully inserted";
else
echo" error occured";
//if($row=mysql_fetch_array($result))
//echo $row['
?>

naval joshi wrote:
thanx a lot it worked........wat shd be the code fr display full datbasee nnnnnnshd i usee the datagrid?
you can use a datagrid if you want, or a tile list, or a list, or an advanced datagrid, it's entirely up to you and what you plan to do with the data.
The Full working basic code for what you're trying to do is this:
Flex code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="send_data()">
    <mx:Script>
    <![CDATA[
        import mx.rpc.events.ResultEvent;
        import mx.controls.DataGrid
        private function send_data():void
            userRequest.send();
        private function handleResult(evt:ResultEvent):void
            dg1.dataProvider = evt.result.player;
    ]]>
    </mx:Script>
    <mx:Label x="79" y="89" text="username"/>
    <mx:Label x="79" y="128" text="rolnumber"/>
    <mx:TextInput id="nm" x="153" y="87"/>
    <mx:TextInput x="153" y="126" id="roll"/>
    <mx:Button x="127" y="191" label="submit" id="sub" click="send_data()"/>
    <mx:HTTPService id="userRequest" result="handleResult(event)" url="http://localhost/connect.php" useProxy="false" method="POST">
        <mx:request xmlns="">
            <username>{nm.text}</username><rollnumber>{roll.text}</rollnumber>
        </mx:request>
    </mx:HTTPService>
    <mx:DataGrid id="dg1" x="69" y="261">
        <mx:columns>
            <mx:DataGridColumn headerText="Name" dataField="name"/>
            <mx:DataGridColumn headerText="Roll" dataField="roll"/>
        </mx:columns>
    </mx:DataGrid>
</mx:Application>
PHP Code:
<?php
    mysql_connect("localhost", "root", "") or die("cannot connect");
    mysql_select_db("std_db") or die("cannot select database");
    if ($_POST["username"])
        $name = mysql_real_escape_string($_POST["username"]);
        $roll = mysql_real_escape_string($_POST["rollnumber"]);
        $query = "INSERT INTO student (name , roll) VALUES ('$name', '$roll')";
        if(mysql_query($query))
            echo "sucessfully inserted";
        else
            echo" error occured";
    $query="SELECT * FROM student";
    $result = mysql_query($query);
    $num_rows = mysql_numrows($result);
    $i=0;
    while ($i < $num_rows)
        $getName = mysql_result($result,$i,"name");
        $getRoll = mysql_result($result,$i,"roll");
        print "<player><name>".$getName."</name><roll>".$getRoll."</roll></player>";
        $i++;
?>

Similar Messages

  • Flex with php air application

    Hi ,
    I am new in flex.
    Actually i make a flex with php desktop application. There are two problems which i am not getting:
    a.) I make three module which i load on tab navigator click . These mudules working fine . But when i make this project export relese build to make .exe file . These modules not added in installation file.
    i.e after installation i have to copy these modules .swf file in program files where the application installed. So i want to know is there is any method so that module added in the .exe file so that they by default goes at the
    time of installation of exe.
    b.) I use php services in this project and when i insatlled the application to system its not working untill i add the the project service php file and zend frame work folder on user wamp . Is there any method that all these happen by default at the time of insatllation.

    Hi,
    AIR is best suited to be a client application.
    P.S: Since you are using PHP, you may want to take a look at
    amfphp so that you can use AMF to speed up data transfer between
    your AIR app and the PHP server.

  • Connecting oracle with php

    hi all,
    i am using Xammp 1.7.4, PHP version 5.3.5, apache 2.2, and oracle 11g. actually i know how to connect MySql using php, but now i am trying to connect oracle using php. Can any 1 tell me the clear cut steps to do the same ?

    You need to add the right oci8 DLL or .so to php.ini and make sure it has access to Oracle client libraries. These Oracle libraries are from an Oracle Home or Oracle Instant Client.
    Without knowing your platform and whether the Oracle DB is on the same machine as Xampp the best place to start is to look at
    http://www.oracle.com/technetwork/articles/technote-php-instant-084410.html

  • Anyone use Flex with php for file upload? PHP Notice:  Undefined index:  Filedata

    My code works. It uploads the file and inputs the file name into a database, but I can't shake this php notice. I think php is looking for multipart/form-data from the HTML form tag.
    <form action="upload.php"  enctype="multipart/form-data"/>
    But I am using flex. The multipart/form-data info is sent as the second default argument of the upload() function. Does anyone have experience with this? Thanks.
    PHP Notice:  Undefined index:  Filedata
    $filename = $_FILES['Filedata']['name'];
    public function selectHandler(event:Event):void {
                    request = new URLRequest(UPLOAD_DIR);
                    try {
                        fileRef.upload(request);
                        textarea1.text = "Uploading " + fileRef.name + "...";
                    catch (error:Error) {
                        trace("Unable to upload file.");
                        textarea1.text += "\nUnable to upload file.";

    Hi, Thanks for your reply !
    Im not getting any errors Flex side, as i say i get a alert message saying the file has been uploaded so . .
    I am using a Wamp server on a windows machine, how do i check the file permissions on both the folder and the php file ?
    Also how do i debug a php file ?
    ANy help would be thankful !

  • FLEX with PHP (Overview)

    Hello FLEX-PHP Gurus,
    I am a PHP programmer who wants to start using FLEX.
    I need to create of graphing applications that take huge
    amounts of data from the server.I have the Flex 2 SDK with
    charting. I am using Apache as my web server. I understand that I
    would need an AMF to communicate between PHP and Flex2. What else
    would I need?
    Also, am I losing out on any Flex functionality by not using
    Java technologies at the backend?
    Thanks,
    Rati

    Catch one of the webcasts. That cleared things up for me. web
    service is XML, so it is slower than the binary data transfers (amf
    or weborbs). I am a complete newb to flex...but that is the messag
    that was conveyed, the more data, the bigger the benefit of the amf
    stuff.
    http://www.themidnightcoders.com/blog/.
    I am only using the serbvice though, and it is simple
    compared to what would be required in c# or php to consume the web
    service.
    some benchmarks:
    http://www.jamesward.org/wordpress/2007/04/30/ajax-and-flex-data-loading-benchmarks/

  • Connecting Flex to PHP returned XML

    Hello! im new to flex and i have a question that i am hoping
    someone can answer. I have a flex app that i am building that needs
    to display a list of dynamic images, preferably with icons. I've
    built the Title list, but i don't know how to connect the
    HTTPService data to the list. the HTTPService is returning XML
    data, so it must be easy. but, as i said, Im really new. Please
    Help Me!!

    "arthurlockman" <[email protected]> wrote in
    message
    news:g7kk4g$177$[email protected]..
    > Hello! im new to flex and i have a question that i am
    hoping someone can
    > answer. I have a flex app that i am building that needs
    to display a list
    > of
    > dynamic images, preferably with icons. I've built the
    list, but i don't
    > know
    > how to connect the HTTPService data to the list. the
    HTTPService is
    > returning
    > XML data, so it must be easy. but, as i said, Im really
    new. Please Help
    > Me!!
    >
    Depending on what you're wanting to do, you can either use a
    Repeater with
    an Image or custom component that contains an Image or you
    can use a List
    based component to display an Image or custom component with
    an Image (or
    SwfLoader, or Loader) in it. There is literally a ton of
    stuff about this
    in the Help. Here are some places you may want to try:
    Help>Flex Start Page>Creating a Simple RIA
    Help>Help Contents>User Interfaces
    - Using Data Providers and Collections
    - Controls
    - Image
    - SwfLoader
    - Using Data Driven Controls
    - Using Item Renderers and Item Editors
    - Dynamically Repeating Controls and Containers
    Here is an example that might get you running fast *if* you
    are not the type
    to read the docs:
    http://examples.adobe.com/flex2/inproduct/sdk/photoviewer/PhotoViewer.html
    HTH;
    Amy

  • Problems with flex and php.

    Hello, my name is Gamaliel Arredondo, i have to develope a project in flash builder 4 using the data service to connect with php, the application has installed the zend framework automatically just like the tutorials said, I use xampp and i have the files in the htdoc location, all the path are correct but when i want to connect to my php classes i receive this message:
    Make sure that Zend Framework is installed correctly and  the parameter "amf.production" is not set to true in the amf_config.ini file  located in the project output folder.     /0/onResultÿÿÿÿ � Uflex.messaging.messages.AcknowledgeMessage correlationId clientId destination messageId timestamp timeToLive headers  body I797BFBCC-250A-A100-9954-68CD2AC82DF5 I2570DA6E-2F76-55E9-2249-000075B2C293  I590AA123-C3CE-5F48-6A94-00002F9B370A  126571301000      ‡G
    I have searched on internet in order to find a solution but i haven't found anything that can help me, so i would like to receive some of help, my email is [email protected], if you can help me i will thank you so much, have a nice day.

    Hello, I am Gamaliel Arredondo, i have solved this problem, the error is in the code, you have a mistake in your code, check it out.
    The way to run the flex applications, in my case, i installed xampp, in the htdoc directory i put the folder with the files of the application and all is working very well, only when the apache is running because if it is stoped the application show error, please review your code and if you have problems you can contact me by e-mail ([email protected]) i also fought with that problem but i could find the solution, i hope to help you.

  • Searching a Mysql Database With PHP and FLEX 2.0

    Hi there
    I need help with an adobe Flex 2 PHP Mysql project.
    This project has a search feature where the user selects
    Criteria based on 3 dropdown components that are populated with
    dynamic data from PHP MYSQL.
    When the user selects these 3 criterias,we would like the
    results to be displayed on the flex application under the search
    bar,
    Please let me know If You would be interested.
    I have Adobe Connect,MSN,AIM,SKYPE,YAHOO,etc.
    We can offer more work after this job has been completed.
    I am an 8 year Internet veteran with a Mass amount of
    Work,and projects,for flex.
    Please at least email me with any questions,
    Thanks
    Brandon James Broga
    web technologies
    [email protected]
    aim = brandonjb2008
    msn= [email protected]
    yahoo = webtechhost

    ...Have you gotten any replies on this yet? If not...I've
    been putting small web apps, and web-enabled clients, together
    under pressure for nearly 10 years...Mostly
    VBscript/Javascript/SQLserver/Oracle, but I can do JSP and have
    also dabbled in PHP/MySQL (my
    Movies
    Database Page is in PHP/MySQL). I've been trying to get some
    time to setup a Flex 3 container on my home server, probly I'll use
    WebOrb...
    Lemme know,
    Pudnik

  • Help with PHP and FLEX integration

    Hello i was wondering how to use php sessions with flex, i
    need a way to have secure connections between flex and php.
    I am using a script i made to pass mysql commands/results
    between them, and i am currently passing the php session id with
    the transactions. But if anyone gets a hold of a valid php session
    id then they will be able to use it. Possibly using flex server to
    have secure transactions?
    If i host both the flex created swf and the php file on a
    https server will it "talk" securely?
    thanks lots

    You may get a quicker answer from Cartweaver's newsgroups.
    http://www.cartweaver.com/support/
    They're usually quite prompt and helpful.

  • MSSQL connection with PHP in DW

    Hello,
    I know that DW 8 has a built-in connection when using php
    with a mysql database.
    However, I would like to connect to a remote Microsoft SQL
    Server with DW and php.
    Is there a way to make this connection ? Probably not
    built-in but maybe through any other way ? I have full access to
    the SQL Server.
    Thanks in advance for your help.
    Marion

    MarionKi wrote:
    > Hello,
    > I know that DW 8 has a built-in connection when using
    php with a mysql
    > database.
    > However, I would like to connect to a remote Microsoft
    SQL Server with DW and
    > php.
    > Is there a way to make this connection ? Probably not
    built-in but maybe
    > through any other way ? I have full access to the SQL
    Server.
    All the server behaviors in Dreamweaver are MySQL specific,
    so even if
    you make a connection, none of the DW code will work.
    PHP 5 introduced PDO (PHP Data Objects), which allow
    connection to any
    database (providing the appropriate drivers are installed on
    the
    server). However, DW doesn't yet support PDO.
    You will need to hand-code everything yourself.
    David Powers, Adobe Community Expert
    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • Connecting SIebel CRM On Demand with PHP

    Hi, I need to consume web services of SIebel CRM On Demand with PHP.
    I reading the documentation about CRM but this have examples with C#.
    In the documentation i need first loggin in the CRM, but i dont know how connect from PHP.
    Please Can you give some links about SIebel CRM with PHP.
    Regards,
    Ricardo

    This is in PHP and will return the session ID.
    $this->crmdomain points to your URL.
    function login() {
    $url = $this->crmdomain . "/Services/Integration?command=login";
    $page = "/Services/Integration?command=login";
    $headers = array("GET ".$page." HTTP/1.0",
    "UserName: YOUR USERNAME",
    "Password: YOUR PASSWORD",
    $this->ch = curl_init();
    curl_setopt($this->ch, CURLOPT_URL,$url);
    curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($this->ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, FALSE);
    curl_setopt($this->ch, CURLOPT_HEADER, true);
    $data = curl_exec($this->ch);
    if (!curl_errno($this->ch)) {
    $SessionId = substr($data,(strpos($data,"Set-Cookie:")+23),(strpos($data,";")-strpos($data,"Set-Cookie:")-23));
    curl_close($this->ch);
    return $SessionId;
    } else {
    return(0);
    }//endof

  • Can Flex 4.6 connect directly with a MS WCF

    Can Flex 4.6 connect directly with a MS WCF without having to use a 3rd party tool like WebOrb.  I have several basic httpprotocal wcf services that I want to move to a mobile app with Flex. Any feed back or insight will be appriceated.

    The correct answer to this question appears to be that Apple's terms of service *do not* prohibit the loading of swf's on IOS from remote servers dynamically at runtime.  They prohibit the loading of swf's that *contain executable ActionScript code*. 
    I loaded a PPT into Adobe Connect and then retrieved the resultant slide swf's from the Connect server.  I took these swf's and loaded them into my iPad app, dynamically at runtime, from a remote server.  The swf's loaded and animations played.  I made no changes to my code.  I'm just using a plain old SWFLoader object.
    Loading swf's dynamically at runtime from remote servers into IOS works - if you make the swf's right.  How to do that I'm not sure.

  • DI Server installation and connection with PHP

    hello,
      We've installed DI Server, started it, but the WSClient file comming with the installation doesn't work.
    a) Is the IIS needed for the DIServer to work?
    If not, what do I need to do to be able to connect to the DIServer. There's no WSDL file with the DIServer.
    b) Do I need to create my own WSDL file and put it on a Web folder?
    I say this because I'm trying to connect with PHP to the server and PEARClient from PHP needs an URL (normally the WSDL file) to connect. It's just too confusing and there is no much help in the documentation.
    thanks and greetings,
    Guillem Barnolas.
    www.softime.es

    DI server provides you a simple COM interface that
    accepts SOAP commands and returns you SOAP reply.
    The format of these SOAP messages is in the SDK
    documentation.
    You should build your own web infrastructure on
    top of this mechanism.

  • Dreamweaver connect to Access DB with PHP

    Is it possible to use dreamweaver to connect to an access db
    with PHP? I know the option in DW is PHP MySQL. I love dreamweaver
    and hate that future versions won't support asp. So I'm trying to
    expand my horizons to the PHP MySQL Apache phenomenon. I'm having a
    hell of a time with mysql and apache, so before I give up entirely,
    I figured maybe I'll take baby steps. So in an effort to get a
    working dynamic site and to learn PHP at the same time, I want to
    do the above mentioned?
    Can I do it?

    Mack879w wrote:
    > I keep getting errors from the service not starting to
    the Instance
    > Config Wiz not even starting. Solutions range from
    reinstalling to hacking the
    > exe and recompiling. (Both of these solutions come from
    the MySQL website).
    I've never heard of anything like that being necessary. It
    sounds as
    though you have either downloaded the wrong version of MySQL
    or there is
    something blocking the program (probably a firewall or
    anti-virus
    program). MySQL comes complete with a Windows installer, so
    it should be
    no different from installing any other program. However, many
    people
    find that XAMPP solves all their problems, as it installs
    Apache, PHP,
    MySQL, and phpMyAdmin in a single operation.
    > just gets so aggrevating. I have a little expirience
    with ASP and never had
    > these difficulties. I don't want to part with
    Dreamweaver and use Expression
    As I said before, Dreamweaver is NOT ending support for
    classic ASP. I
    haven't tried Expression Web, but online reviews say it has
    only limited
    support for ASP.
    Since ASP is no longer being developed by Microsoft, sooner
    or later
    you'll have to bite the bullet and switch to ASP.NET, PHP, or
    ColdFusion.
    David Powers, Adobe Community Expert
    Author, "The Essential Guide to Dreamweaver CS3" (friends of
    ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • Connect xml with flex

    Dear Friends,
    iam doing my first project in flex. trying to connect a xml
    generated by php connected to mysql. i took an example from the
    following link:
    http://www.adobe.com/cfusion/communityengine/index.cfm?event=showDetails&postId=5561&produ ctId=2&loc=en_US
    my xml is generated. working fine. when i run my Flex, it is
    not working. it is giving the following error
    Process terminated without establishing connection to
    debugger.
    Command:
    "C:\Program Files\Adobe\Flex Builder
    3\sdks\3.2.0\bin\adl.exe"
    C:\Rahim\TestApplications\Flexapplication\xmltest\bin-debug\xmltest-app.xml
    C:\Rahim\TestApplications\Flexapplication\xmltest\bin-debug
    Output from command:
    invocation forwarded to primary instance
    my flex file is :
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    initialize="doSend()"
    layout="absolute">
    <mx:Script>
    <![CDATA[
    import mx.collections.ArrayCollection;
    import mx.rpc.events.ResultEvent;
    [Bindable]
    private var datalist:ArrayCollection;
    private function resultHandler(event:ResultEvent):void{
    datalist = event.result.data.row;
    public function doSend():void {
    xmlFromDatabase.url = "
    http://localhost/flex/flexdb.php";
    xmlFromDatabase.send();
    ]]>
    </mx:Script>
    <mx:HTTPService url="
    http://localhost/flex/flexdb.php"
    id="xmlFromDatabase"
    showBusyCursor="true"
    result="resultHandler(event)"
    method="GET" />
    <mx:DataGrid x="10" y="10" dataProvider="{datalist}"
    id="dg">
    <mx:columns>
    <mx:DataGridColumn headerText="Col1" dataField="id"/>
    </mx:columns>
    </mx:DataGrid>
    </mx:Application>
    Thanks and Regards,
    Syed Abdul Rahim

    hi _funkyboy ,
    thks for ur msg. i tried using run also.. still not
    running... can u pls advice me wt to do. i got struct up.. i have
    to do this.
    tell me how to connect xml which was generated by php and
    fetch the data and display in Flex.
    thanks and regards,
    Syed Abdul Rahim

Maybe you are looking for

  • CPU Problem with Fl studio running bootcamp

    I have the latest MPBr 13' 8gb i5, I'm running FL Studio on bootcamp but for some reason the CPU is always maxed even though i have like four channels running. Any reason why?

  • Adobe form javascript error

    hi experts, i am new to adobe interactive forms. i have created a simple form with some input fields which refer to abap webdynpro context and added a submit button from webdynpro activex menu. the click event is created in abap web dynpro. when i ex

  • Mac is freezing no programs running yet no trouble for other user

    My mac keeps freezing yet no trouble for other user. No program's run without 5 mins of coloured wheel rotating. Also time machine not operating properly as computer is not recognising it. Apple support centre not much help as it took them 10 mins ju

  • Ibooks will not download purchased books from cloud on iPad

    I have an iPad 1 and I have recently downloaded version 5.01 onto it but in the process all my music and books were gone. I was able to retrieve all of my music but whenever I try to redownload the books I have already purchased in the ibooks store i

  • Light Room import site info from Dreamweaver.

    What is the best way to upload a lightroom gallery? directly to the website or export it to the folder where Dreamweaver stores the site and then Sync?