I’m using the mySQL to xml tutorial and I modified the php to match the table structure that I’m workig with.
What I’m having difficulty with is calling the php file that is creating the dynamic xml file.
What frame action can I use to load the php variable and once that is done, do I call the dynamic xml in my action script by creating a new xml object and then calling the ‘xml_output’ variable?
here is the php code which i modified to match mySQL table structure. Please let me know if i made any syntax erors:
///////////////////////////////////////////////////////////////////////
<?php
header(“Content-type: text/xml”);
$host = “localhost”;
$user = “user”;
$pass = “password”;
$database = “xtratainment”;
$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 files ORDER BY clientID DESC”;
$resultID = mysql_query($query, $linkID) or die(“Data not found.”);
$xml_output = “<?xml version=“1.0”?>
“;
$xml_output .= “<thumbnails width=“100” height=“900” distance=”-2” velocity=“4” path=“thumbs/”>
“;
for($x = 0 ; $x < mysql_num_rows($resultID) ; $x++){
$row = mysql_fetch_assoc($resultID);
$xml_output .= " <item>
“;
$xml_output .= " <date>” . $row[‘date’] . “</date>
“;
$xml_output .= " <title>” . $row[‘title’] . “</title>
“;
// Escaping illegal characters
$row[‘bio’] = str_replace(”&”, “&”, $row[‘bio’]);
$row[‘bio’] = str_replace(”<”, “<”, $row[‘bio’]);
$row[‘bio’] = str_replace(”>", “>”, $row[‘bio’]);
$row[‘bio’] = str_replace(""", “”", $row[‘bio’]);
$xml_output .= " <bio>" . $row[‘bio’] . "</bio>
“;
$xml_output .= " <phone>” . $row[‘phone’] . "</phone>
“;
$xml_output .= " <email>” . $row[‘email’] . "</email>
“;
$xml_output .= " <url>” . $row[‘url’] . "</url>
“;
$xml_output .= " <region>” . $row[‘region’] . "</region>
“;
$xml_output .= " <services>” . $row[‘services’] . "</services>
“;
$xml_output .= " <pic1>” . $row[‘pic1’] . "</pic1>
“;
$xml_output .= " <pic2>” . $row[‘pic2’] . "</pic2>
“;
$xml_output .= " <pic3>” . $row[‘pic3’] . "</pic3>
“;
$xml_output .= " <pic4>” . $row[‘pic4’] . "</pic4>
“;
$xml_output .= " <pic5>” . $row[‘pic5’] . "</pic5>
";
$xml_output .= " </item>
";
}
$xml_output .= “</thumbnails>”;
echo $xml_output;
?>
/////////////////////////////////////////////////////////////////////////