all groups > flash data integration > april 2007 >
You're in the

flash data integration

group:

need help on displaying an article in flash 8 using php call out


need help on displaying an article in flash 8 using php call out piksel8
4/15/2007 1:56:01 PM
flash data integration:
Hi I'm trying to make a news viewing function in Flash 8. The swf calls out a
php script, php script queries the MySQL DB then php sends info to swf file to
display it. Unfortunately, the articles don't display and I keep getting
"undefined" errors. I don't have this problem when I tested it on my PC but
after upoading it to my host the problem arose.

I hope someone can help me. Thanks!

this is the script i used in flash 8 to call out the PHP script:

function getData(ref) {
sectionContent = new LoadVars();
sectionContent.ignoreWhite = true;
sectionContent.onLoad = function(success) {
wait._visible = false;
if (success) {
pressHead.text = this.headline;
var newsPic = this.picture;
var picEmbed = '<img src='+'"'+'images/press/'+this.picture+'"'+'
align="left">';
contentText.html = true;
contentText.htmlText = picEmbed+this.article;

calcSize();
gotoAndPlay(56);
}
};
sectionContent.load("jpg/media.php?row="+ref);
}


this is the script i used in php:


<?
$connect = mysql_connect("localhost", "admin", "password");
mysql_select_db("mydb", $connect);
$sql="SELECT * FROM tbl_press_release";
$result=mysql_query($sql);
$row=mysql_fetch_assoc($result);
if(isset($_GET[$row])){
mysql_query("SELECT * FROM tbl_press_release Where
press_release=".$_GET[$row]."");
}
?>
<? echo "&headline=" . $row["headline"] . " &article=".$row['article']."
&picture=" . $row['image'] . ?>
<?
} mysql_free_result($result);
mysql_close($connect);
?>
Re: need help on displaying an article in flash 8 using php call out MotionMaker
4/19/2007 12:00:00 AM
Your PHP script does not return values if the query fails, if the database is
not connected, if the query returns no results. Thus you may be getting
undefined in those cases.

1. Did you try running the PHP script in the Web browser?
http://www.yourdomain.com/jpg/media.php?row=123
What did it return? That is what Flash is seeing.
2. Did you consider using
http://livedocs.macromedia.com/flash/8/main/00002336.html since the requirement
calls for sending and receiving data?

AddThis Social Bookmark Button