Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

54 users online



Flash database

Flash database

Currently viewing this thread: 1 (0 members and 1 guests)


james182

james182

Neverside Newbie
Status: Offline!

Flash database

hi, i am new to combining flash and php. How would i display text from my DB in to flash field.
here is what i have for my php pagewhich flash loads.

PHP:

<?php
mysql_connect
("localhost","",""); 
mysql_select_db("flashphp"); 

$result mysql_query("select * from content WHERE name='tom'");

while(
$r=mysql_fetch_array($result))
{    
   
$name=$r["name"];
   
$contents=$r["contents"];
   
$id=$r["id"];
}
?>
<?=
"&phptxt=$contents"?>


and flash AS:
(frame action)
loadVariablesNum("phpfile.php", 0, "POST");

i have a dynamic txt field with the Var: phptxt

But what i have doesn't work can someone help plz..

Last edited by james182, July 10th, 2005 05:47 AM (Edited 1 times)

devonair

devonair

Neverside Newbie
Status: Offline!

I'm pretty php/mysql deficient, but you'll need to echo or print a variable to get it back to flash.. Also, I would look into using the LoadVars object rather than loadVariablesNum (unless you're using Flash 5 or lower)...

___________________

obod | weapons of mass dysfunction

Hybridart

Hybridart

Neverside Newbie
Status: Offline!

as devonair said, first in the php you need to add the echo statement to your last line.

echo &phptxt."&"; <--the extra & added at the end helps remove any unwanted carriage returns whitespace etc.

then you need to use

LoadVars() object instead

you may also try using the sendAndLoad function as well.

___________________

"Using a key to gouge expletives on another's vehicle is a sign of trust... and friendship."
- Ignignoc, Aqua Teen Hunger Force
-------------------------------------------------------
[ www.hybridart.com ]

hamstu

hamstu

Neverside Newbie
Status: Offline!

When echoing the results in your php, make sure its all in a form like this:

Code:

&varname=text&varname2=text&varname3=text

So maybe something like...

PHP:

<?php
mysql_connect
("localhost","","");
mysql_select_db("flashphp");

$result mysql_query("select * from content WHERE name='tom'");
$count 1;
while(
$r=mysql_fetch_array($result))

   
$name=$r["name"];
   
$contents=$r["contents"];
   
$id=$r["id"];
   echo 
"&name" "$count" "=$name";
   echo 
"&contents" "$count" "=$contents";
   echo 
"&id" "$count" "=$id";
   
$count++;
}
echo 
"&";
?>


That should work, but I havn't tested it.

___________________

http://www.hamstu.com/images/hamstu_com.gif

Last edited by hamstu, July 14th, 2005 09:18 PM (Edited 1 times)

james182

james182

Neverside Newbie
Status: Offline!

okay got it working but my text has large spaces between each line how do get rid of that????

example:
jasghdhjgdhjsgdjhgd

asdasdasdasdasd
asdasdasdasdasdasdasdasasd
asdasasdasdasdasdasdas

asdasdasdasd

asdasd...

thats just an example my txt is rendered as HTML...

Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0083 seconds.