Hi all,
Im working on this project, and am wanting to make up a temporary XML file but store it as a string in a PHP variable.
Im havign trouble making the string as i want it.
Heres my code which pulls the data from the database, and attempts to put it into XML tags. but when i echo the variable, it just gives me the PHP variables, and not the XML tags.
<?php
include('check_login.php');
$query = "SELECT * FROM stories WHERE approved='yes' ORDER BY date DESC";
$run = mysql_query($query);
$xml = '<?xml version="1.0" ?>';
while($result = mysql_fetch_array($run))
{
$category = $result['category_id'];
$headline = $result['headline'];
$para1 = $result['para1'];
$para2 = $result['para2'];
$body = $result['body'];
$journalist = $result['journalist'];
$jpgurl = $result['jpgurl'];
$wbmpurl = $result['wbmpurl'];
$photographer = $result['photographer'];
$date = $result['date'];
$xml .= '<story>';
$xml .= '<category>'.$category.'</category>';
$xml .= '<headline>'.$headline.'</headline>';
$xml .= '<para1>'.$para1.'</para1>';
$xml .= '<para2>'.$para2.'</para2>';
$xml .= '<body>'.$body.'</body>';
$xml .= '<journalist>'.$journalist.'</journalist>';
$xml .= '<jpgurl>'.$jpgurl.'"</jpgurl>';
$xml .= '<wbmpurl>'.$wbmpurl.'</wbmpurl>';
$xml .= '<photographer>'.$photographer.'</photographer>';
$xml .= '<date>'.$date.'</date>';
$xml .= '</story>';
}
echo $xml;
?>
Please can anyone help me?