Comunidad de diseño web y desarrollo en internet online

flex 2 + amfphp

Citar            
MensajeEscrito el 07 Mar 2007 07:01 pm
hola que tal eh estado investigando como puedo conectarme a una BD con flex por medio de amfphp
y encontre un ejemplo aqui http://www.adobe.com/devnet/flex/articles/flex2_amfphp_02.html
ya logre conectarme y mostrar algunos registros en un datagrid "pero solo eso pura consulta"
que pasa si quiero insertar un registro ? pues tengo que enviar algunos parametros a mi servicio pero ese es mi problema no se como :( ya intente de varias formas pero no logro mandarlos bien

mi codigo del servicio es este

Código :

<?php
// Create new service for PHP Remoting as Class
class sample
{
    function sample () 
    {
        // Define the methodTable for this class in the constructor
        $this->methodTable = array(
            "getUsers" => array(
                "description" => "Return a list of users",
                "access" => "remote"
            )
        );
    }

    function getUsers () {
        $mysql = mysql_connect(localhost, "root", "");
        
        mysql_select_db( "flexphp" );
        //return a list of all the users
        $Query = "SELECT * from users";
        $Result = mysql_query( $Query );
        while ($row = mysql_fetch_object($Result)) {
               $ArrayOfUsers[] = $row;
        }
        return( $ArrayOfUsers );
    }
}
?>


y el codigo de flex es el siguiente

Código :

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" creationComplete="initApplication()">
    <mx:DataGrid dataProvider="{dataProvider}">
        <mx:columns>
            <mx:DataGridColumn headerText="Userid" dataField="userid"/>
            <mx:DataGridColumn headerText="User Name" dataField="username"/>
            <mx:DataGridColumn headerText="User Name" dataField="emailaddress"/>
        </mx:columns>
    </mx:DataGrid>
    <mx:TextArea width="294" height="102" id="texto"/>
    <mx:Script>
        <![CDATA[
            [Bindable]
            public var dataProvider:Array;

            import flash.net.Responder;
 
            public var gateway : RemotingConnection;

            public function initApplication()
            {
                gateway = new RemotingConnection( "http://localhost/amfphp/gateway.php" );
                gateway.call( "sample.getUsers", new Responder(onResult, onFault));
            }

            public function onResult( result : Array ) : void
            {
            dataProvider = result;
            
            }


            public function onFault( fault : String ) : void
            {
                trace( fault );
            }
        ]]>
    </mx:Script>
</mx:Application>


alguien me podria ayudar para poder mandar parametros de flex a mi servicio de amfphp pls
p.d ya cheque el tutorial que hay aqui en la pagina Bases de Datos con Flash y AMFPHP
pero no es = :(
saludos

Por GSer

17 de clabLevel



Genero:Masculino  

Mexico

firefox
Citar            
MensajeEscrito el 11 Mar 2007 06:15 pm

Por Zah

BOFH

4290 de clabLevel

27 tutoriales
5 articulos

  Bastard Operators From Hell Editores

Zaragoza, España

firefox
Citar            
MensajeEscrito el 13 Mar 2007 04:41 am
muchas gracias ^^ problema resuelto :lol:

Por GSer

17 de clabLevel



Genero:Masculino  

Mexico

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.