PDA

View Full Version : [MX2004]PHP -> Flash



Lews
September 19th, 2003, 12:22 PM
I'm trying to get text from a database into Flash via PHP/MySQL.
While this works perfectly outside of Flash (ie. the text shows up fine if I just open the PHP file), I get an "undefined" in my textbox when I try to get the text in Flash.


My PHP file: (this may be sloppy, I'm still a beginner ;))


<?PHP
include ("conf.php");
$dh= $HTTP_POST_VARS["Page"];
$query = "SELECT * FROM denhaag WHERE ID = '1'";
$result = mysql_query($query)
or die (mysql_error());

while ($data = mysql_fetch_assoc($result)) {
extract ($data);

if ($dh == 'huis') {
$huis = $data['huis'];
echo "$huis";
}


elseif ($dh == 'uitgaan') {
$uitgaan = $data['uitgaan'];
echo "$uitgaan";
}


elseif ($dh == 'sport') {
$sport = $data['sport'];
echo "$sport";
}


elseif ($dh == 'geschied') {
$geschied = $data['geschied'];
echo "$geschied";
}

elseif ($dh == 'student') {
$student = $data['student'];
echo "$student";
}

else {
$home = $data['home'];
echo "$home";
}

} ;

?>


This code is in a button in Flash:


on(release)
{
Send = new LoadVars();
Received = new LoadVars();

Page = "huis";
Send.Page= Page;

Send.sendAndLoad("dh.php",Received);
ReceivedText= Received.huis;
Test.text = ReceivedText;
}


Any ideas?

ahmed
September 19th, 2003, 12:25 PM
That not how loadvars works, see this thread, it should guide you through

http://www.kirupaforum.com/forums/showthread.php?threadid=17604

:)

Lews
September 19th, 2003, 02:33 PM
Well, I just followed the instructions in this (http://www.kirupa.com/developer/actionscript/asandphp.htm) tutorial, but I'll check it out. Thanks.

ahmed
September 19th, 2003, 02:46 PM
well, seeing your code, no you didn't :beam:

Lews
September 19th, 2003, 02:48 PM
Huh? :(