Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Data Integration / April 2008



Tip: Looking for answers? Try searching our database.

php to xml

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ulitasch - 17 Apr 2008 17:36 GMT
hello, I work normally only with Dreamweaver and Database, I now want to work
with a flash-movie integrated into my php-site. The flash movie gets data from
a xml-file "index.xml". . I managed to make a php-file which becomes a xml-file
(if I understood right..?) and called it "index.php". But the Flash-file does
not find that.
I wonder what I have to change. In the Flash-file or in the PHP?

<?php

header("Content-type: text/xml");

$host = "localhost";
$user = "username";
$pass = "password";
$database = "db";

$linkID = mysql_connect($host, $user, $pass) or die("Could not connect to
host.");
mysql_select_db($database, $linkID) or die("Could not find database.");

$query = "SELECT * FROM home LIMIT 0, 9";
$resultID = mysql_query($query, $linkID) or die("Data not found.");

$xml_output = "<?xml version=\"1.0\"?>\n";
$xml_output .= "<item>\n";

for($x = 0 ; $x < mysql_num_rows($resultID) ; $x++){
    $row = mysql_fetch_assoc($resultID);
    $xml_output .= "\t<item>\n";
    $xml_output .= "\t\t<idder>" . $row['id'] . "</idder>\n";
    $xml_output .= "\t\t<title>" . $row['title'] . "</title>\n";
    $xml_output .= "\t\t<link>http://www.content.php?id=" . $row['link'] .
"\t?expandable=" . $row['menuLink'] . "</link>\n";
    $xml_output  .=  "\t\t<enclosure url='images/" .  $row['doc'] . "' type='" .  
$row['ext'] . "'/>\n";  
    $xml_output .= "\t</item>\n";
}

$xml_output .= "</item>";

echo $xml_output;

?>
The Feldkircher - 18 Apr 2008 07:49 GMT
Hi

There is a tutorial http://www.gotoandlearn.com that will show you how to do it.
Its called PHP, MySQL and Flash.

Hope it helps
Ulitasch - 18 Apr 2008 22:42 GMT
Thanks a lot!!!:)
This helps to understand the integration..  

But I got a Flash-file (with many actionscripts) where I just would need to
change the XML-file to be filled with database-data. Do I really have to go
deep into the actionscripts to make changes or is there a way to just change
the existing XML-file?
The Feldkircher - 20 Apr 2008 22:25 GMT
Hi

All you have to do is for example myXML.load("index.php")

Flash doesn't car its a php file, it thinks its just a regular xml file.

Once loaded, then you can pull the data from each node however you like.

Hope it helps
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.