Problem with PHP/AS3 - Display PHP query results back to flash via AS3

Posted by Dale J on Stack Overflow See other posts from Stack Overflow or by Dale J
Published on 2010-04-23T20:23:12Z Indexed on 2010/04/23 20:43 UTC
Read the original article Hit count: 630

Filed under:
|
|

Hi,

Ive made a query in PHP, and i'm trying to send the results back into Flash via AS3, but its throwing up this error

Error: Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs. at Error$/throwError() at flash.net::URLVariables/decode() at flash.net::URLVariables() at flash.net::URLLoader/onComplete()

Here is the relevant part of the PHP and AS3 code, including the query. The flash variable rssAdd is passed over to the PHP which it using it in the PHP query accordingly.

$url = $_POST['rssAdd'];
$query= SELECT title
FROM Feed
WHERE category = (SELECT category
FROM Feed
WHERE url =$url) AND url!=$url;
$result = mysql_query($query);
echo  $query;

Here is the AS3 code I've done so far.

function recommendation(){

var request:URLRequest = new URLRequest("url");
request.method = URLRequestMethod.POST

var recVars:URLVariables = new URLVariables();

recVars.rssAdd=rssAdd;
request.data = recVars

var loader:URLLoader = new URLLoader(request);
loader.addEventListener(Event.COMPLETE, onComplete);
loader.dataFormat = URLLoaderDataFormat.TEXT;
loader.load(request);

function onComplete(event:Event):void{
recommend.text = event.target.data;
}
 } 

Any help would be most appreciated, thanks.

© Stack Overflow or respective owner

Related posts about as3

Related posts about php