Jump to content

php in flash??


joebudden

Recommended Posts

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 ");
    }
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.