I have the following code:
<?php
header ("content-type: text/xml" );
print "<?xml version=\"1.0\"?>\n";
mysql_connect ("localhost", "database_username", "**********" ) or die ("<b>Unable to establish connection with MySQL.</b>\n" );
mysql_select_db("database_name") or die ( "<b>Unable to locate specified database.</b>");
$query = "SELECT * FROM client_news ORDER BY date DESC LIMIT 1, 5";
$result = mysql_query ($query);
print "<recent_news>" ;
while($id = mysql_fetch_object( $result )) {
print "<ID>\n";
print "<headline>".$id->headline ."</headline>\n" ;
print "<intro>" .$id ->intro."</ intro>\n";
print "<url>" .$track->url."</url>\n" ;
print "</ID>\n" ;
}
print "</recent_news>";
?>
What I need to add to it, is it writing to a .xml file, then saves it to the database. Can anyone help me or point me in the right direction?