joebudden Posted February 26, 2007 Share Posted February 26, 2007 hi guys. right here is my php page i am trying to load variables from .. PHP <?php // connect to database include("connect.php"); // set the variables that have been posted isset($_POST['teamid']); isset($_POST['gameid']); // get a player query $query = "SELECT playersurname FROM player"; $result = mysql_query($query) or die (mysql_error()); $row = mysql_fetch_assoc($result); // define variables $myteamid = $_POST["teamid"]; $gameid = $_POST["gameid"]; // flash variables echo "&myteamid=".urlencode($myteamid); echo "&gameid=".urlencode($gameid); echo "&player=".urlencode($row['playersurname']); ?> The variables myteamid and gameid were originally session variables but flash didnt seem to like the session_start so i decided to post them from the previous page. When i run the php page in a browser it displays all of the variables fine. But then when i view the flash file the variables myteamid and gameid are not displayed. However the other variable player displays fine as it is just a simple query. Why is this happening?? is it because flash doesnt know what value has been passed.. Can anyone think of another way round or solution ??? I could really do with a fast solution as all of my queries depend on these two variables. Im gonna try and implement them as GET variables but i have a suspicion that i will just get the same result. If anyone has any experience with using SESSION, POST or GET variables in queries to use in AS/Flash please please please please please post a reply Cheers dudes , thanx in advance.. JB ps. here is my action script... /* first create a new instance of the LoadVars object */ myVars = new LoadVars(); // call the load method to load my php page myVars.load("http://localhost:6789/pp33tt/__PHPManager__/flash/flash3.php", _root, "POST"); myVars.myteamid; myVars.gameid; myVars.player; myVars.onLoad = function (success) { if (success) { myteamid.text = myVars.gameid; player.text = myVars.player; gameid.text = this.myVars.gameid; trace (" variables loaded "); for( var test in this ) { trace (" key " + test + " = " + this[test]); } } else { trace (" Error loading variables "); } } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.