/    Sign up×
Community /Pin to ProfileBookmark

I really need some help here – PHP and FLASH

Hi,

I’m currently building a Flash website but I need it to be able retrieve text from a MySQL database – to make it easier to update.

I’ve had some help from a few online tutorials and have managed to get it kind of working. When I open the .swf locally (straight off my hard drive) it retrieves the text from the database with no problems – however it does display the following message onscreen quickly before the text is loaded: _level0.pass_var (where pass_var is the variable I am trying to pass from PHP to Flash aswell as the variable name of the dynamic text field the text should be loaded into)

However if I open the html file with the swf embedded in it, it only displays the _level0.pass_var message and doesn’t load the text from the database. The same happens if I try to open the swf or html on my server.

Below is the PHP code I have written (content_handler.php):

<?php

$target_page = $_GET[‘page’];

$global_dbh = mysql_connect($dbhost, $dbuser, $dbpass) or die(“Could not connect to host.”);
mysql_select_db($dbname, $global_dbh) or die(“Could not find database.”);

$query = “SELECT Content FROM $tablename WHERE Page = ‘$target_page’ ORDER BY ID DESC LIMIT 1”;
$result = mysql_query($query, $global_dbh);
$data = mysql_fetch_array($result);

$pass_data = $data[‘Content’];

echo “&pass_var=$pass_data”;

mysql_free_result($result);
mysql_close($global_dbh);

?>

Below is the ActionScript code (from my Flash movie), on the same frame (but different layer) as the dynamic textfield – pass_var:

stop();
loadVariables(“http://somedomain.com.au/flash_test/content_handler.php?page=about_us”,””,”GET“);

There is a very good chance that the code I’ve written is crap as I’m new to flash… I’d really appreciate some help with this… if anyone can. It’s driving me crazy.

Thanks a lot,

Brad

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @braddles69 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.3,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...