Reputation: 21
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.
Upvotes: 1
Views: 1586
Reputation: 21
Fixed it with the following return:
$result = mysql_query($query);
$row=mysql_fetch_array($result);
print ("recTitle=".urlencode($row['title']));
Upvotes: 1
Reputation: 4215
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.
Upvotes: 1