2 Replies Latest reply on Apr 15, 2007 3:07 PM by portuguesedanny

    HTTPService search/return db value

      Could someone help me by giving an example of how I might go about searching for a value in a db using HTTPService? (you've probably guessed it, I'm a newb ;-) any help gratefully received)

      <mx:HTTPService id="nameRequest" url=" http://localhost/amfphp/services/name.php" useProxy="false" method="POST">
      <mx:request xmlns="">

        • 1. Re: HTTPService search/return db value
          ntsiii Level 3
          You must have some server-side code that does the db integration, and that communicates with Flex vis one of the three RPC protocols.
          • 2. Re: HTTPService search/return db value
            portuguesedanny Level 1
            Hi Tracy,

            I do have some server side PHP scripts that query/insert records in the MySQL db, what I am having trouble with is how do I go about binding the returned httpservice data (xml formated, however not a static xml file) to an arrayCollection so that I can then apply a filterFunction..?


            Here is my app (sorry for posting all this code)

            <?xml version="1.0" encoding="utf-8"?>
            <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" xmlns="*" layout="absolute" backgroundGradientColors="[#0080ff,#80ffff]" creationComplete="send_data()">

            <!-- This is the Script to SetUp Functions-->
            private function youveClicked():void {
            mx.controls.Alert.show('You Clicked!!!');
            private function send_data():void {

            <!-- This is the HTTPService-->
            useProxy="false" method="POST"-->
            <mx:HTTPService id="staffcodeRequest" url="" useProxy="false" method="POST">
            <mx:request xmlns="">
            <firstname>{firstname.text}</firstname><surname>{surname.text}</surname><staffcode>{staff code.text}</staffcode><emailaddress>{emailaddress.text}</emailaddress><department>{departm ent.text}</department>

            <mx:Panel layout="absolute" cornerRadius="50" left="0" right="0" top="0" bottom="58">

            <!-- This is the Add Panel-->
            <mx:Panel layout="absolute" title="Add Staff Member" id="panel_AddStaffMember" backgroundColor="#0080ff" width="796" x="10" height="140" y="443">
            <mx:Label x="10" y="10" text="First Name" id="label_FirstName"/>
            <mx:Label x="444" y="12" text="Surname" id="label_Surname"/>
            <mx:Label x="10" y="38" text="Staff Code" id="label_StaffCode"/>
            <mx:Label x="444" y="38" text="Email Address" id="label_EmailAddress"/>
            <mx:Label x="10" y="66" text="Department" id="label_Department"/>
            <mx:TextInput x="96" y="8" width="200" id="firstname"/>
            <mx:TextInput x="530" y="10" width="200" id="surname"/>
            <mx:TextInput x="96" y="36" width="200" id="staffcode"/>
            <mx:TextInput x="530" y="36" width="200" id="emailaddress"/>
            <mx:TextInput x="96" y="64" width="200" id="department"/>
            <mx:Button label="Submit" click="send_data(),youveClicked()" x="304" y="64" id="button_SubmitButton"/>

            <!-- This is the Show and Search Panel-->
            <mx:Panel x="10" y="10" width="796" height="425" layout="absolute" backgroundColor="#0080ff" id="panel_DisplayStaffMember" title="Search Staff Member">
            <mx:DataGrid id="dgStaffcodeRequest" x="10" y="114" dataProvider="{staffcodeRequest.lastResult.stafflist.staffid}" width="567" height="231">
            <mx:DataGridColumn headerText="Staff Code" dataField="staffcode"/>
            <mx:DataGridColumn headerText="First Name" dataField="firstname"/>
            <mx:DataGridColumn headerText="Surname" dataField="surname"/>
            <mx:DataGridColumn headerText="Department" dataField="department"/>
            <mx:TextInput x="10" y="353" id="selectedemailaddress" text="{dgStaffcodeRequest.selectedItem.emailaddress}" width="284" textAlign="left"/>

            <!--mx:Label x="10" y="10" text="Staff Code Search" id="label_StaffCodeSearch" width="105"/>
            <mx:TextInput x="123" y="8" width="61" id="txtinput_StaffcodeSearchInput"/>
            <mx:Button x="192" y="8" label="Search" click="search_data()" id="button_SearchButton"/>
            <mx:LinkButton label="Google" width="52"
            click="navigateToURL(new URLRequest(' http://www.google.co.uk'))" x="666" y="353"/-->