I'm trying to integrate my database with my flash site. Right now, it's set up to pull in xml pages that contain the information, so I don't need to parse the XML. I just need help creating a php file that will get the info from the database.
This is what I've been working on so far, but it's just not working. What am I doing wrong.
PHP:
<?xml version="1.0" encoding="iso-8859-1"?>
<newsarticles>
<?php
/connect to database/
mysql_pconnect("localhost","user","password");
/prepare query/
$query = "SELECT headline, link FROM xmltest";
/execute query/
$result = mysql_db_query("dbname",$query);
/extract results/
while(list($headline,$link)=mysql_fetch_row($result)) {
print "<article><url>$link</url><healine_text>$headline</headline_text></article>";
}
mysql_free_result($result);
?>
</newsarticles>
Here is the XML page eqivalent that works with the flash movie:
<?xml version="1.0" encoding="iso-8859-1"?>
<newsarticle>
<article>
<url>http://www.site.com/article1.php</url>
<headline_text>Article 1</headline_text>
</article>
<article>
<url>http://www.site.com/article2.php</url>
<headline_text>Article 2</headline_text>
</article>
<article>
<url>http://www.site.com/article3.php</url>
<headline_text>Article 3</headline_text>
</article>
</newsarticle>