Load Var From Mysql Into Flash

I have the following code (flash.php)

<?
include "config_system.php";
include "idatabase.php";
include "ifunctions.php";

$connection = pg_connect( $connection_string ) or die ("Falha de Conexo ao Banco de Dados");

$sql_empresas = "SELECT * FROM empresas";
$query1 = exec_sql($connection,$sql_empresas);
$count_empresas = record_count($query1);

$sql_hh = "SELECT * FROM head_hunters";
$query2 = exec_sql($connection,$sql_hh);
$count_hh = record_count($query2);

$sql_vagas = "SELECT * FROM vagas";
$query3 = exec_sql($connection,$sql_vagas);
$count_vagas = record_count($query3);
?>

Empresas <? echo $count_empresas ?>
<br>
Head Hunters <? echo $count_hh ?>
<br>
Vagas <? echo $count_vagas ?>

Well, Id like to have $count_empresas, $count_hh and $count_vagas to be show in a flash movie
into a dynamic text field
called count_empresas, count_hh and count_vagas

How can I do that??
What is the code to do that??

Tkz ;)
[1107 byte] By [rogernem] at [2007-11-19 2:42:34]
# 1 Re: Load Var From Mysql Into Flash
When you echo or print the HTML for your Flash Applet, put the values you want to pass to flash on the query string the same way you would do if you were trying to make a link to a PHP script. Then in your ActionScript in the flash applet the query string variables ?var1=x&var2=y you will access exactly as you do in php like $var1, $var2.
Mutilated1 at 2007-11-10 3:58:42 >
# 2 Re: Load Var From Mysql Into Flash
Thats right. I got it like that:

echo "&var1=$count_empresas&var2=$count_empresas&var3=$count_hh&";

but what do I need to do now in Flash to retrieve that??

What would the code be like??

Thanks
rogernem at 2007-11-10 3:59:53 >
# 3 Re: Load Var From Mysql Into Flash
OK in flash now just check the values of $var1, $var2, and $var3
Mutilated1 at 2007-11-10 4:00:49 >
# 4 Re: Load Var From Mysql Into Flash
Best way to do it in my opinion is to make your php script output xml data. Then load the data using flashes xml parser.
thebee at 2007-11-10 4:01:54 >
# 5 Re: Load Var From Mysql Into Flash
Hi
There is a beautilful code that you need to write into
the flash file..i.e you need to call the php file from flash
using the load_vars command which you will find like this
in flash
>>window>>actions>>
will open the action window
>> click + sign
>>ACtions>>browser/network>>
select loadvariable or geturl method to find the way out
thats it

happy coding..:_)
infodeamon at 2007-11-10 4:02:53 >
# 6 Re: Load Var From Mysql Into Flash
Best way to do it in my opinion is to make your php script output xml data. Then load the data using flashes xml parser.

Only do that if you are going to only pass the values in once, in which case passing the values on the query string is still easier. Flash's XML parser has a memory leak and if you parse XML repeatedly with it you will in short order hang the browser. The only reason I could see to take the trouble to output XML would be if you can find another use for the XML outside of Flash. But you will still need to watch out if you are going to fetch XML parse it, fetch XML parse it, etc... over and over. If you just want to pass a few paramters to flash, the query string method is the quickest and easiest way to get there.
Mutilated1 at 2007-11-10 4:03:52 >
# 7 Re: Load Var From Mysql Into Flash
Thank u all.
It worked.
rogernem at 2007-11-10 4:04:51 >