All I am trying to do is create an XML feed so that I can submit it to a site. However no matter what I do (albeit with my limited size of brain) all I get are errors. It hates pound signs and apostrophes even if I try the only thing I know which is string replaces. Please someone help. I will post this in the PHP section too.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>RAD Feed</title>


$username = ""; //Database Username
$password = ""; //Database Password
$hostname = ""; //Database Host
$dbname = ""; //Database (or Catalog in MySQL parlance) name
$dbh = mysql_connect($hostname, $username, $password) or die("Could not connect to database server");
$selected = mysql_select_db($dbname, $dbh) or die("Database not found or problem connecting");
$result = mysql_query("SELECT position, postdate, jobref, jobid, country, description FROM jobs");

// if the file exists already, delete it first to flush data
$xmlfeedfile = "jobfeed.xml";
$filehandle = fopen($xmlfeedfile, 'w');
$itemLink = $fullurl.'/info_jobid_'.$b[jobid].'.html';

$xmlString = '<?xml version="1.0" encoding="utf-8"?>
fwrite($filehandle, $xmlString);
while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
$xmlString = '<job>
<title>' . $row{position} . '</title>
<date>' . $row{postdate} . '</date>
<referencenumber>' . $row{jobref} . '</referencenumber>
<url><a href="http://www.*****.co.uk' . $fullurl . '/info_jobid_' . $row{jobid} . '.html" target="job' . $row{jobid} . '">' . $row{jobref} . '</a></url>
<country>United Kingdom</country>
<description>' . $row{description} . '</description>
fwrite($filehandle, $xmlString);
fwrite($filehandle, "</source>");



7 Years
Discussion Span
Last Post by Facte

I can't see any # or &s in your code. If you have any in your variables you probably need to guard these variables using ![CDATA[...]]


Hi there, the £ and &'s come directly out of the mysql database and I can't change that because it is uploaded directly via clients.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.