[swx] SWX and MySQL

wizkit peter at wizk.it
Thu Jul 31 05:14:36 PDT 2008


Hello,

I recently upgraded to a newer version of Flash and lost my Remoting 
components and could not work with AMFPHP in Flash anymore. Before 
searching for the remoting components I thought to try out SWX as an 
alternative since it doesn't require these components. But I stumbled 
upon a problem when trying to work with a MySQL resultset. In the 
Service Explorer the resultset is shown nicely (because it uses AMFPHP I 
guess?), but when I test it in Flash the Data Analyzer returns

Value = Error 256: Unhandled data type (resource) in 
D:\xampp\htdocs\swx\php\SwxAssembler.php, line 145.

Do I have to turn my resultset into an array? The code I am trying to 
get to work is below. If I could get this to work, I could use my AMFPHP 
services without modification in SWX, that would be great.

Looking forward to your replies.

Peter
------------------------------------------------------------------------

*the SWX Service Method:*

    function getMenu()
        {
            include_once "connect.php"; // some script to connect to
    your database
            $sql="SELECT * FROM sometable";
            $rs1 = mysql_query($sql);
            return $rs1;
        }


*Actionscript:*

    import org.swxformat.SWX;

    var swx:SWX = new SWX();
    swx.gateway = "http://localhost/swx/php/swx.php";
    swx.debug = true;

    var callParameters:Object =
        {
            serviceClass: "menubar",
            method: "getMenu",
            result: [this, resultHandler],
            args: ""
        }
    swx.call(callParameters);

    function resultHandler(event:Object)
    {
        this.myDatagrid.dataProvider = event.result;
    }

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/swx_osflash.org/attachments/20080731/d7b71907/attachment.html 


More information about the swx mailing list