Groups | Blog | Home
all groups > flash data integration > november 2005 >

flash data integration : flash + php + mysql


Motion Maker
11/12/2005 9:30:43 PM
You only need to echo the data and not the HTML to Flash and build a Flash
interface. You can echo either URL vars and use the LoadVars object on the
Flash side or echo XML and use the XML object on the Flash side. Flash
LoadVars or XML can also send data back to PHP.

This is a basic example I use in seminars to show an echo Flash to PHP and
back using XML

http://www.hosfordusa.com/ClickSystems/courses/flash/examples/XMLPHP/EX01/XMLPHPEchoEx01_Doc.php

Here is an example I use to show reading mySQL with PHP and sending to Flash

http://www.hosfordusa.com/ClickSystems/courses/flash/examples/XMLPHPMySql/Ex01/XMLPHPMySQLEx01_Doc.php

See if they help or further help you for more targeted questions.

--
Lon Hosford
www.lonhosford.com
May many happy bits flow your way!
[quoted text, click to view]
i have a blog which currently uses php + mysql only and i wanted to
integrate
the data into flash,this is what i did in the php version of my blog( i used
a
DBAL to get the data from a db):

$table =$prefix . 'blog';
$sql = "SELECT * FROM $table WHERE blog_author ='1' && blog_pub ='1' ORDER
BY
blog_id DESC LIMIT 10";
$result = $db->Execute($sql) or die($db->ErrorMsg());
while ($row = $result->FetchNextObject())
{
$blog_id = $row->BLOG_ID;
$blog_title = $row->BLOG_TITLE;
$cat = $row->BLOG_CAT;
$blog_post = $row->BLOG_POST;
$blog_pub = $row->BLOG_PUB;
$auid = $row->BLOG_AUTHOR;
$blog_pwd = $row->BLOG_PWD;
$blog_pwdtf = $row->BLOG_PWDTF;
$blog_date = date("l F d Y", $row->BLOG_TIMESTAMP);
$table =$prefix . 'user';
$sql="SELECT * FROM $table WHERE id='$auid'";
$resultname = $db->Execute($sql) or die($db->ErrorMsg());
while ($row = $resultname->FetchNextObject())
{
$blog_author = $row->NAME;
}
$table =$prefix . 'blogcat';
$sql = "SELECT * FROM $table WHERE cat_id ='$cat'";
$resultcat = $db->Execute($sql) or die($db->ErrorMsg());
while ($row = $resultcat->FetchNextObject())
{
$blog_cat = $row->CAT_NAME;
}
$table=$prefix . 'comments';
$sql = "SELECT blog_comid FROM $table WHERE blog_com_id=$blog_id";
$resultcom = $db->Execute($sql) or die($db->ErrorMsg());
$blog_com_rows = $resultcom->RecordCount();
if($blog_pwdtf == 1)
{
print"<div id=\"title\"><img src=\"$root/images/tick.png\"
/>$blog_title</div>";
print"<span class=\"content\">This post is password protected.<form
name=\"\" method=\"post\" action=\"$root/?id=2\">
Password :
<input type=\"password\" name=\"pass\">
<input name=\"post_id\" type=\"hidden\" id=\"post_id\"
value=\"$blog_id\">
<input type=\"submit\" name=\"Submit\" value=\"Submit\">
</form></span>";
print"<div id=\"end\">Enter password to view post details.</div><br/>";
}
else{
print"<div id=\"title\"><img src=\"$root/images/tick.png\"
/>$blog_title</div>";
print"<span class=\"content\">$blog_post</span>";
print"<div id=\"end\">";
if($blog_com_rows)
{
echo "<a href=\"$root/?post_id=$blog_id\">$blog_com_rows comments</a>|";
}
else
{
echo"<a href=\"$root/?post_id=$blog_id\">leave a comment</a> |";
}
print"POsted by $blog_author on $blog_date.</div><br/>";
}
}
if($result->RecordCount() == 0){
print"no posts to display";
}
print"</div>";

lwq
11/13/2005 12:00:00 AM
i have a blog which currently uses php + mysql only and i wanted to integrate
the data into flash,this is what i did in the php version of my blog( i used a
DBAL to get the data from a db):

$table =$prefix . 'blog';
$sql = "SELECT * FROM $table WHERE blog_author ='1' && blog_pub ='1' ORDER BY
blog_id DESC LIMIT 10";
$result = $db->Execute($sql) or die($db->ErrorMsg());
while ($row = $result->FetchNextObject())
{
$blog_id = $row->BLOG_ID;
$blog_title = $row->BLOG_TITLE;
$cat = $row->BLOG_CAT;
$blog_post = $row->BLOG_POST;
$blog_pub = $row->BLOG_PUB;
$auid = $row->BLOG_AUTHOR;
$blog_pwd = $row->BLOG_PWD;
$blog_pwdtf = $row->BLOG_PWDTF;
$blog_date = date("l F d Y", $row->BLOG_TIMESTAMP);
$table =$prefix . 'user';
$sql="SELECT * FROM $table WHERE id='$auid'";
$resultname = $db->Execute($sql) or die($db->ErrorMsg());
while ($row = $resultname->FetchNextObject())
{
$blog_author = $row->NAME;
}
$table =$prefix . 'blogcat';
$sql = "SELECT * FROM $table WHERE cat_id ='$cat'";
$resultcat = $db->Execute($sql) or die($db->ErrorMsg());
while ($row = $resultcat->FetchNextObject())
{
$blog_cat = $row->CAT_NAME;
}
$table=$prefix . 'comments';
$sql = "SELECT blog_comid FROM $table WHERE blog_com_id=$blog_id";
$resultcom = $db->Execute($sql) or die($db->ErrorMsg());
$blog_com_rows = $resultcom->RecordCount();
if($blog_pwdtf == 1)
{
print"<div id=\"title\"><img src=\"$root/images/tick.png\"
/>$blog_title</div>";
print"<span class=\"content\">This post is password protected.<form
name=\"\" method=\"post\" action=\"$root/?id=2\">
Password :
<input type=\"password\" name=\"pass\">
<input name=\"post_id\" type=\"hidden\" id=\"post_id\" value=\"$blog_id\">
<input type=\"submit\" name=\"Submit\" value=\"Submit\">
</form></span>";
print"<div id=\"end\">Enter password to view post details.</div><br/>";
}
else{
print"<div id=\"title\"><img src=\"$root/images/tick.png\"
/>$blog_title</div>";
print"<span class=\"content\">$blog_post</span>";
print"<div id=\"end\">";
if($blog_com_rows)
{
echo "<a href=\"$root/?post_id=$blog_id\">$blog_com_rows comments</a>|";
}
else
{
echo"<a href=\"$root/?post_id=$blog_id\">leave a comment</a> |";
}
print"POsted by $blog_author on $blog_date.</div><br/>";
}
}
if($result->RecordCount() == 0){
print"no posts to display";
}
print"</div>";
AddThis Social Bookmark Button