Hello All,
I am using the sendAndLoad class to perform a script through PHP and load the variables back into the swf. Using Firefox Firebug, I am able to tell that everything is executing correctly, including the PHP script returning the following variables:
&mySubscriberID=36&firstName=Bill
But the variables are not making it back into the swf file in a usable fashion. The variables sent back look like this:
}
Variable _level0.recLV = [object #3, class ‘LoadVars’] {
onLoad:[function ‘onLoad’],
mySubscriberID:“36”,
firstName:“Bill”
}
Using a colon instead of an equal sign?
Here is the code for the first frame of my flash file:
[LEFT]stop();
var sendLV = new LoadVars();
var recLV = new LoadVars();
recLV.onLoad = function(success:Boolean){
trace("recLV back from php");
}
sendLV.onLoad = function(success:Boolean){
nextFrame();
trace("sendLV back from php");
}
sendLV.sendAndLoad("connect7a.php",recLV);
[/LEFT]
and here is frame 2:
[LEFT]stop();
recLV.createTextField("t_txt", 1, 100, 100, 1, 1);
recLV.t_txt.autoSize = true;
recLV.t_txt.text = "My email address is " + recLV.emailaddress + ".
";
recLV.t_txt.text += "My subscriber id is " + recLV.mySubscriberID + ".
";
recLV.t_txt.text += "My first name is " + recLV.firstName + ".
";
[/LEFT]
And here is the PHP code:
<?php
$emailaddress='bill@mydomain.com';
$dbhost='localhost';
$username='myuser';
$password='mypass';
$database='mydb';
$conn = mysql_connect($dbhost,$username,$password) or die ('Error connecting to mysql');
mysql_select_db($database) or die ('Unable to select database');
$result = mysql_query("SELECT * FROM email_list_subscribers WHERE emailaddress='$emailaddress'")
or die(mysql_error());
$row = mysql_fetch_array( $result );
$subscriberid = $row['subscriberid'];
$sql = 'SELECT * FROM email_subscribers_data WHERE subscriberid = "' . $row['subscriberid'] . '"';
$result = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_array( $result )) {
if($row['fieldid']==2) {
$fname = $row['data'];
echo "&mySubscriberID=$subscriberid&firstName=$fname";
}
}
?>
I also have dynamic text fields with the above variables assigned to them. Any ideas on why the swf is not receiving the data correctly? ANY help at all would be appreciated. Thanks in advance!