
July 29th, 2012, 12:40 AM
|
 |
Metal-Freak
|
|
Join Date: Jun 2001
Location: Kuala Lumpur, Malaysia
Posts: 45
Time spent in forums: 1 h 17 m 36 sec
Reputation Power: 13
|
|
|
ActionScript 3 - Passing data from php to flash error.
Can anybody help me with this?
here's my php code
Code:
<?php
$username="user";
$password="password
$database="website";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT *
FROM `wp_posts`
WHERE `ID`
IN (
SELECT `object_id`
FROM `wp_term_relationships`
WHERE `term_taxonomy_id` =1
OR `term_taxonomy_id` =3
OR `term_taxonomy_id` =4
)
AND `post_status` = 'publish'
ORDER BY `wp_posts`.`post_date` DESC
LIMIT 5";
$result=mysql_query($query) or die( "Query error");
$num=mysql_numrows($result);
mysql_close();
//echo "<b><center>Database Output</center></b><br><br>";
$i=0;
while ($i < $num) {
$theID=mysql_result($result,$i,"ID");
$field1=mysql_result($result,$i,"post_author");
$field2=mysql_result($result,$i,"post_date");
$field3=mysql_result($result,$i,"post_title");
$field4=mysql_result($result,$i,"post_status");
$field5=mysql_result($result,$i,"post_type");
$theResult .= "result$i&$field3&$theID";
$i++;
}
print "results=$theResult";
?>
Here's my actionscript
Code:
var loader:URLLoader = new URLLoader();
loader.dataFormat=URLLoaderDataFormat.VARIABLES;
loader.addEventListener(Event.COMPLETE, completeHandler);
var request:URLRequest = new URLRequest("test.php");
request.method=URLRequestMethod.POST;
var userID:uint;
var username:String;
function completeHandler(e:Event):void {
var loader:URLLoader = URLLoader(e.target);
var vars:URLVariables = new URLVariables(loader.data);
Object(root).output_txt= vars.results;
}
loader.load(request);
I keep getting this error
Code:
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()
What in the blue hell is going on?
While I am at it, how do I break apart strings in AS3? I know in AS2 you can use the String.split function...
__________________
SCUMGRIEF
|