[swx] SWX and MySQL
ben
ben_da_dog at yahoo.co.uk
Thu Jul 31 06:08:16 PDT 2008
Hi Peter,
Yes, I think mysql_query return a resource type
(http://au2.php.net/manual/en/function.mysql-query.php) and resource
type isn't handled by SWX in the conversion.
So yes, you'll need to do a mysql_fetch_assoc or something similar to
return a format that's recognised, in this case an array.
And yes, I do believe the Service Explorer uses amfphp. Vaguely remember
a previous post about this.
Hope that helps.
Ben
wizkit wrote:
> 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;
> }
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> swx mailing list
> swx at osflash.org
> http://osflash.org/mailman/listinfo/swx_osflash.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/swx_osflash.org/attachments/20080731/1d0779c6/attachment.html
More information about the swx
mailing list