...

View Full Version : Creating XML From MySQL



Pee-H-Pee
09-25-2004, 02:28 PM
I am trying to generate an XML feed from a MySQL database. It isn't working as I am sure I haven't made my script right. I would appreciate any help... here is my current script:


<? include("config.php"); ?>
<? header("Content-Type: text/xml"); ?>

<?
$result = mysql_query("select * from products ORDER by name ASC LIMIT 10") or die (mysql_error());
while ($row = mysql_fetch_array($result))
{

echo "<products>
<link>$row[link]</link>
<name>$row[name]</name>
<description>$row[description]</description>
</products>";

}
mysql_free_result($result);
?>

dniwebdesign
09-25-2004, 06:14 PM
Don't know if this will help but here we go anyway:


<? include("config.php"); ?>
<? header("Content-Type: text/xml"); ?>

<?
$result = mysql_query("SELECT * FROM products ORDER BY name ASC LIMIT 10") or die (mysql_error());
while ($row = mysql_fetch_array($result))
{
echo "<products>
<link>".$row[link]."</link>
<name>".$row[name]."</name>
<description>".$row[description]."</description>
</products>";

}
mysql_free_result($result);
?>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum