The flash php script I am using works fine with variables assigned directly from the script. Once I use php to gather the variables dynamically it does not work. Any help would be appreciated.
Here is an example that works:
<?php
$tour_city = ‘WALNUT CREEK ~ $1,450,000’;
$tour_address = ‘55570 PACIFIC HEIGHTS, WALNUT CREEK, CA’;
$tour_unid = ‘TOUR #644657’;
$tour_mls = ‘MLS #40465821’;
echo “city_price=” . $tour_city . “&” . “address=” . $tour_address . “&” . “tour_id=” . $tour_unid . “&” . “mls_id=” . $tour_mls;
?>
Here is the example the does not work:
<?php
function load_data()
echo “city_price=” . $tour_city . “&” . “address=” . $tour_address . “&” . “tour_id=” . $tour_unid . “&” . “mls_id=” . $tour_mls;
{
$tour_id = ‘435’;
//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password)
or die(“Unable to connect to MySQL”);
$selected = mysql_select_db(“testaccount”,$dbhandle)
or die(“Could not select examples”);
$query=“SELECT * FROM tour_list
WHERE tour_list_id=$tour_id”;
$result=mysql_query($query);
$row = mysql_fetch_assoc($result);
$tour_address = $row[‘tour_address’];
$tour_city = $row[‘tour_city’];
$tour_mls = $row[‘tour_mls’];
$tour_unid = $row[‘tour_unid’];
//close the connection
mysql_close($dbhandle);
}
?>
Here is the flash code:
var phpFile:String = “info.php”;
var myLoader:URLLoader = new URLLoader();
myLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
var urlRequest:URLRequest = new URLRequest(phpFile);
myLoader.load(urlRequest);
myLoader.addEventListener(Event.COMPLETE, loadComplete);
function loadComplete(evt:Event):void {
// Display the value with variable name “Candidate”
city_price_txt.text = evt.target.data.city_price;
//Display the value with variable name “Date”
address_txt.text = evt.target.data.address;
tour_id_txt.text = evt.target.data.tour_id;
mls_id_txt.text = evt.target.data.mls_id;
}
I have been trying to see what the problem is and can’t make it work.
Thank you to any one that can help.