Flash Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignFlash Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 29th, 2012, 12:40 AM
Scumgrief's Avatar
Scumgrief Scumgrief is offline
Metal-Freak
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2001
Location: Kuala Lumpur, Malaysia
Posts: 45 Scumgrief User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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

Reply With Quote
  #2  
Old July 29th, 2012, 08:26 AM
E-Oreo's Avatar
E-Oreo E-Oreo is offline
Lost in code
Dev Shed God 7th Plane (8000 - 8499 posts)
 
Join Date: Dec 2004
Posts: 8,057 E-Oreo User rank is General 92nd Grade (Above 100000 Reputation Level)E-Oreo User rank is General 92nd Grade (Above 100000 Reputation Level)E-Oreo User rank is General 92nd Grade (Above 100000 Reputation Level)E-Oreo User rank is General 92nd Grade (Above 100000 Reputation Level)E-Oreo User rank is General 92nd Grade (Above 100000 Reputation Level)E-Oreo User rank is General 92nd Grade (Above 100000 Reputation Level)E-Oreo User rank is General 92nd Grade (Above 100000 Reputation Level)E-Oreo User rank is General 92nd Grade (Above 100000 Reputation Level)E-Oreo User rank is General 92nd Grade (Above 100000 Reputation Level)E-Oreo User rank is General 92nd Grade (Above 100000 Reputation Level)E-Oreo User rank is General 92nd Grade (Above 100000 Reputation Level)E-Oreo User rank is General 92nd Grade (Above 100000 Reputation Level)E-Oreo User rank is General 92nd Grade (Above 100000 Reputation Level)E-Oreo User rank is General 92nd Grade (Above 100000 Reputation Level)E-Oreo User rank is General 92nd Grade (Above 100000 Reputation Level)E-Oreo User rank is General 92nd Grade (Above 100000 Reputation Level)  Folding Points: 945 Folding Title: Novice Folder
Time spent in forums: 2 Months 1 Day 6 h 47 sec
Reputation Power: 7104
A "URL-encoded query string containing name/value pairs" is the same type of string that you would see in the address bar of your browser, something like: "var1=value1&var2=value2&var3=value3"

There are certain characters that you cannot use in the value without encoding them; one of those characters is &, since it has special meaning (a variable separate).

PHP has a urlencode function that you can use to automatically apply the necessary encoding to the value.
__________________
PHP FAQ
How to program a basic, secure login system using PHP
Connect with me on LinkedIn


Quote:
Originally Posted by Spad
Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignFlash Help > ActionScript 3 - Passing data from php to flash error.

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap