3 Replies Latest reply on Oct 3, 2007 10:06 AM by camfieldaj

    Application To Update Database

    wy790289
      Hi,

      I try creating an Flex application that calling a php program via HTTPService to retrieve database information (i.e. MySQL) is very easy and nice. But I cannot found the tutorial about creating an flex applicaion to let user enter or update informations and write back to database using php. I only found the tutorials by using FDS and also ColdFusion, which ColdFusion is a expensive (the Product itself and the learning effort) product. I just want to use a low cost and easy ways to create a database update program by Flex. Does Flex only can update database information by using FDS + any Java Application Servers? Is there any documents that show how to update database by php?

      Thanks a lot!
        • 1. Re: Application To Update Database
          Panji_BALI
          i am still looking for solutions to this matter... please let me know / post here if you found one...

          Need someone to put some guide/tutorial for PHP and Flex.. maybe Mike Potter would give some? (pleaaseee.. :) )
          • 2. Re: Application To Update Database
            dave cragg Level 2
            A simple overview of how I do this.

            Use the "request" property of the httpService to set any data that needs to go to the server. For example, you might have a service like this:

            <mx:HTTPService id="updateUserService"
            url="{urlsXML.updateuser}"
            useProxy="false"
            showBusyCursor="true"
            method="POST"
            resultFormat="object"
            result="updateUserResult(event)"
            fault="updateUserFault(event)" >
            <mx:request>
            <token>{token}</token>
            <userid>{user.UserID}</userid >
            <username>{user.UserName}</username >
            <otherdata>{user.OtherData}</otherdata >
            </mx:request>
            </mx:HTTPService>

            Then on the PHP side, use $_POST to extract the posted data and feed that into an UPDATE or INSERT query.
            • 3. Re: Application To Update Database
              camfieldaj Level 1
              This looks much more complicated than it is:

              <mx:HTTPService id="form1"
              url=" http://193.81.20.30/vips/vips_post.php"
              method="POST"
              useProxy="False"
              resultFormat="text"
              result="postResultHandler(event);"
              fault="postFaultHandler(event);" >
              <mx:request xmlns="" >
              <vid>{vid_inp.text}</vid>
              <VIPName>{vipname_inp.text}</VIPName>
              <VIPAddress>{vipaddress_inp.text}</VIPAddress>
              <ExternalAddress>{external_inp.text}</ExternalAddress>
              <appName>{"vips"}</appName>
              </mx:request>
              </mx:HTTPService>

              I use the name of the php script in url. It isn't really a service, but it works the same. Result and fault both point at functions in your Flex app that will be called depending on the result of the call to form1. The php script receives the values thus $vid = $_POST["vid"];

              And that's pretty much it. You can do some pretty amazing things with Flex and some simple php scripting. Finding simple explanations of how to do these things is another matter, however