Skip to main content
Applauz
Inspiring
December 3, 2017
Answered

Very strange problem. The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs. [HELP]

  • December 3, 2017
  • 2 replies
  • 2371 views

I am having a strange issue.

I'm reading SQL through a PHP file. Everything was working fine... then all of a sudden the account that sits in the first slot on the database is getting this error every time it tries to read the SQL.

Error: Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs.

However every other account works fine. This is only happening for account in slot #1 ...  any idea why this would start happening or how I can fix? It's driving me nuts.

This topic has been closed for replies.
Correct answer Applauz

SO this is 100% not a problem with my SQL, Database, etc .. this is a problem with pulling a php variable back in to Animate CC.

If I build a new project and have a php file passing variable like this '

print("parentIDResult=peanut butter & jelly");  It has the same problem .. it cannot do this.

So now ... how on earth can I get this to allow an ampersand  ?   


So for anyone who runs in to this in the future... I managed to figure this out and solve the problem.

There are 2 key pieces to this.

In order for my app to store the data from the app with an ampersand you must use ( mysql_real_escape_string ) in your php call. ( this I already had ).

child1RewardName8='".mysql_real_escape_string($child1RewardName8)."',

This allows you to store the ampersand and special characters in your database.

When you are reading the database and passing that data back to animate cc you have to use ( rawurlencode ) in your php.

&child1RewardName8Status=".rawurlencode($child1RewardName8Status)."

2 replies

Known Participant
March 11, 2019

Had the same problem just another Idea for solving it is

when sending it

URLfile = URLfile.split("&").join("AND");

urlvars.TheFile = URLfile;

and when receiving it

myfile = myfile.split("AND").join("&");

if it is a hacking problem it might help?

kglad
Community Expert
December 3, 2017

the data got corrupted in that first slot?

inspect your table/line for an error.

Applauz
ApplauzAuthor
Inspiring
December 3, 2017

So when I do a test trace out

trace("THE SQL DATA AS A WHOLE IS: " + event.target.data);

This returns back every single SQL value for the user .. and every entry is there.

However if I try to trace any of the individual entries like this.. it fails.

  trace(event.target.data.parentIDResult);

and it only happens with the account that is in ID #1 on the database....  ID #2 and up are fine... thousands of other accounts are fine. 

What specifically do you recommend I do ?

kglad
Community Expert
December 3, 2017

manually inspect the problematic table.