1
votes

Ive made a query in PHP, and I'm trying to send the results back into Flash via AS3, but it's 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 is 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.VARIABLES;
loader.load(request);

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

Any help would be most appreciated, thanks.

2
Are you wrapping your SQL instruction ($query) with quotes?Jorge Guberte
no, I hadnt, thanks. It compiles now, although nothing is shown in the text box, when there should be a result. (i tested the query in HeidiSql, replacing $url, with the url that should be held in rssAdd, and there is a result.)Dale J
I'd say it parses fine now, rather than compiles :Palex

2 Answers

1
votes

Have you checked what is coming back from the server running your PHP application? Checking the details of the request and the response, using Firefox and the Net panel of Firebug, could shed light on some other unexpected problem with the web server.

1
votes

Fixed it with the following return:

$result = mysql_query($query);
$row=mysql_fetch_array($result);
print ("recTitle=".urlencode($row['title']));