LOAD VAR FROM MYSQL INTO FLASH

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rogernem
Forum Newbie
Posts: 8
Joined: Mon Nov 08, 2004 6:03 am

LOAD VAR FROM MYSQL INTO FLASH

Post 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 ;)
peni
Forum Commoner
Posts: 34
Joined: Thu Nov 18, 2004 1:15 pm

Post 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.
rogernem
Forum Newbie
Posts: 8
Joined: Mon Nov 08, 2004 6:03 am

Post by rogernem »

Can u explain that better please?

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

Tkz
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

Post 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]
Post Reply