PDA

View Full Version : MySQL and Flash


cocoonfx
02-15-2009, 08:09 PM
Hello Chaps


I have been trying to link flash to a basic mysql database, but i am not having much luck. I have also tried some on line tutorials.

I have a php file with an xml section, and then i have a flash file which calls the XML. The php works but the flash does not. I have checked the action script and this is fine. Any ideas?

PHP code below

<?php
$dbh=mysql_connect ("localhost", "user", "pword");
mysql_select_db ("db");

$query =("SELECT * FROM test");
$result =mysql_query($query,$dbh);
///$rowA = mysql_fetch_array($result);

echo "<?xml version=\"1.0\"?>\n";
echo "Comment\n";

while($line = mysql_fetch_assoc($result)) {
echo "<item>".$line["Comment"]."</item>\n";
}
echo "</Comment>\n";

mysql_close($dbh);

?>

Action Script.

var theXML:XML=new XML();
theXML.ignoreWhite = true;

theXML.onLoad = function() {
var nodes = this.firstChild.childNodes;
for (i=0;i<nodes.length;i++){
thelist.addItem(nodes[i].firstChild.nodeValue,i);
}
}

theXML.load("http://www.cocoonfxmedia.co.uk/cms/sites.php");

edbr
02-16-2009, 02:07 AM
im really not sure about this as I am having an issue also but do you not have to use fwrite to make a new xml document?

cocoonfx
02-19-2009, 11:44 AM
I am not sure, i was hoping to use xml with php and action script but it just does not work. All the tutorials i have tried are very good.... i would love to know how to do this..... :confused: