2

I've got a strange problem with a php file. I'm trying to get some data from a mysql database and then return it back to the AS3, and that's been going fine, until I did any change whatsoever to one of the php files. The 2 php files are standard php code, to get data from the database so the main file has at the top..

session_start();

require_once 'gSQL.php';

require_once 'fb.php';

And gSQL has various functions relating to my game, like I said all that was working fine, until I literally did anything to the gSQL.php file, even just opening it in DW, saving it with a different name, and then resaving it back to it's original name *without changing the content at all), uploading it to the server stops my AS3 code from working, where as before the re-save, the exact same code allowed my as3 code to work fine!

The as3 line that is acting strange is "if (this.returnvars.scores)", here's the top part of the AS3 function where the line is situated.

function completeGame(event:Event):void
{
this.returnvars = new URLVariables(this._game.data);

if (this.returnvars.scores)
{

With the original gSQL.php file, the line "if(this.returnvars.scores)" works and the program goes into that code block, but with the different (but the same) file "if(this.returnsvars.scores) is false and it jumps over it, i've looked at the contents of "returnvars.scores" and from what I can see it's exactly the same for both files, but something must be different.

The only thing I can think of is the encoding of the file, which DW tells me is UTF-8, and that's what it's being saved back to the server as...if I upload to the server the original gSQL.php file, the one I didn't do anything to (not even resaved the name) the AS3 works fine..any ideas??

1
  • Added a PHP tag to your post, since its not an actionscript problem. Commented Oct 11, 2011 at 0:42

1 Answer 1

1

Check that the flash file you are embedding has the

allowScriptAccess="sameDomain" 

paramater in the embed flash object code, it seems to help with a lot of odd issues.

Failing that, make sure after you upload your PHP file that it has at least 644 permissions.

-Ev

Sign up to request clarification or add additional context in comments.

4 Comments

Just checked, the new file has the same permissions, I'm also testing it straight, just running the .swf not embedding.
If you are testing it straight from the SWF, how can you load session_start(); require_once 'gSQL.php'; require_once 'fb.php';
Session start etc is in my main php file, which I'm calling from the swf, with the usual, var request:URLRequest = new URLRequest(url); request.method = URLRequestMethod.POST; _game.load(request); and so on....it all works fine, and loads the score data, unless I change gSQL.php in anyway.
Ok I got things working, the problem seemed to be white space at the end of the new file, even though the old file had the same, oh well, got it working, thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.