Page 1 of 1

LOAD VAR FROM MYSQL INTO FLASH

Posted: Thu Nov 18, 2004 2:28 pm
by rogernem
I have the following code (flash.php)

Code: Select all

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

$connection = pg_connect( $connection_string ) or die ("Falha de Conexão 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, I´d 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 ;)

Posted: Thu Nov 18, 2004 3:55 pm
by peni
you will have to form the vars and their values like an url:
count_empresas=asd%20asd&count_hh=blabla&count_vagas=1

first you output it (it has to be the only line you output) let flash get the file with "loadVariables('flash.php')" or sth like that - don't know anymore.

Posted: Thu Nov 18, 2004 8:04 pm
by rogernem
Can u explain that better please?

How can I form that as a url in my code?

Tkz

Posted: Thu Nov 18, 2004 8:37 pm
by neophyte
Flash wil retrieve variables from POST or GET methods. So some how you have to put that variable information into a query string. So one way you could do it is have flash.php redirect to another page with a query string.

Code: Select all

<?php
 header(location:"someotherpage.php?foo=1&bar=2");
?>
Then I think all you have to do in flash to retrieve those variables is use the load_vars() function.
In action script something like:

vagas = loadVariables( );

Create a dynamic text box and name it vagas in the properties panel. That ought to do it. I'd test it but I'm on linux right now and don't have flash available.

Here's some good stuff on it.[/url]