Am trying to write a php script that exports a database and prints out the contents as XMl. So for i have this
<?php
require('connect.php');
$query = mysql_query("SELECT * FROM blog_comments");
$database="MyWebsite";
$table = "blog_comments";
echo mysql_error();
echo "<?xml version=\"1.0\" encoding=\"utf-8\" ?>";
echo "<$database>";
$i=0;
while($row=mysql_fetch_assoc($query))
{
echo "<$table>";
while ($i < mysql_num_fields($query))
{
$meta = mysql_fetch_field($query);
echo "<".$meta->name.">".$row['$meta->name']."</".$meta->name."><br/>";
$i++;
}
$i=0;
echo "</$table>";
}
echo "</$database>";
?>
And my output is
<?xml version="1.0" encoding="utf-8" ?>
<MyWebsite>
<blog_comments>
<></>
<></>
<></>
<></>
<></>
<></>
<></>
<></>
</blog_comments>
<blog_comments>
<></><></><></><></><></><></><></><></>
</blog_comments>
<blog_comments>
<></><></><></><></><></><></><></><></>
</blog_comments>
<blog_comments>
<></><></><></><></><></><></><></><></>
</blog_comments>
<blog_comments>
<></><></><></><></><></><></><></><></>
</blog_comments>
<blog_comments>
<></><></><></><></><></><></><></><></>
</blog_comments>
<blog_comments>
<></><></><></><></><></><></><></><></>
</blog_comments>
<MyWebsite>
The number of everything is correct but for some reason i am not getting the values printed. Am doing this because my websites host doesn't allow remote database connections and I need to connect to a database from my java application. So i want to call a php page from my java app and it would respond with xml containing my data and i then parse this XML and use the relevant data
I need help on how to make this work so i can achieve the above goal.. thanks Thanks a lot.
{}button. See the Editing Help for details.