I have a MySQL database from where i need som info. presented in flash.
Here’s my PHP code. E.g. i need the info(vars) of $europePercentage to be presented in my movieclip in flash.
Can anyone help me with the AS (flash) code to make this possible?
Hope someone can help
/Kafir
<?php
// start the session
session_start();
include ($_SERVER["DOCUMENT_ROOT"] . "/include.php");
include_once ($GLOBALS['homeDir'] . "common/functions.php");
// check whether the user is logged in or not
//checkUserLogin();
// initalize vars
$europePercentage = $northAmericaPercentage = $southAmericaPercentage = $asiaPercentage = $africaPercentage = $australiaPercentage = 0;
// get each of the countries and set them
$sql = "SELECT cID AS id, cTitle AS title FROM tblCountry UNION SELECT coID AS id, coTitle AS title FROM tblContinent";
$result = mysql_query($sql)
or die("error: " . mysql_error());
while($myRow = mysql_fetch_assoc($result))
{
$$myRow['title'] = $myRow['id'];
}
// get the total number of residences
$sql = "SELECT COUNT(rID) AS cnt FROM tblRessidence";
$result = mysql_query($sql)
or die("error: " . mysql_error());
while($myRow = mysql_fetch_assoc($result))
{
$totalRes = $myRow['cnt'];
}
// get residences pr. continent
$sql = "SELECT coTitle, COUNT(r_ciID) AS coCnt FROM tblContinent, tblCountry, tblRegion, tblCity, tblRessidence WHERE coID = c_coID AND cID = rg_cID AND rgID = ci_rgID AND ciID = r_ciID GROUP BY coTitle";
$result = mysql_query($sql)
or die("error: " . mysql_error());
while($myRow = mysql_fetch_assoc($result))
{
switch($myRow['coTitle'])
{
case "Europe": $europePercentage = ceil(($myRow['coCnt'] / $totalRes)*100); break;
case "Asia": $asiaPercentage = ceil(($myRow['coCnt'] / $totalRes)*100); break;
case "Africa": $africaPercentage = ceil(($myRow['coCnt'] / $totalRes)*100); break;
case "North America": $northAmericaPercentage = ceil(($myRow['coCnt'] / $totalRes)*100); break;
case "South America": $southAmericaPercentage = ceil(($myRow['coCnt'] / $totalRes)*100); break;
case "Australia and Oceania": $australiaPercentage = ceil(($myRow['coCnt'] / $totalRes)*100); break;
}
}
print "Europe: " . $europePercentage . "<BR>";
print "Asia: " . $asiaPercentage . "<BR>";
print "Africa: " . $africaPercentage . "<BR>";
print "North America: " . $northAmericaPercentage . "<BR>";
print "South America: " . $southAmericaPercentage . "<BR>";
print "Australia and Oceania: " . $australiaPercentage . "<BR>";
?>
Getting vars from MySQL to Flash