php-parse-xml - Fehler: StartTag: invalid element name

Ich habe ein ernstes problem mit dem abrufen von Daten aus einer sql-Abfrage in php in eine xml. Ich bekomme immer den Fehler: StartTag: invalid element name. The Start-Element is a Number ich weiß nicht, ob das zählt?!?

Vielleicht Euch kann mir helfen!!

PHP:

$query = "SELECT r.object_id,
t.term_taxonomy_id,
t.term_id,
t.taxonomy,
t.description,
p.post_date_gmt,
p.post_content,
p.post_title,
p.post_excerpt 
FROM wp_posts p,
wp_term_taxonomy t,
wp_term_relationships r
WHERE r.object_id= p.id
AND t.term_taxonomy_id = r.term_taxonomy_id
AND p.post_status = 'publish'
AND p.post_type = 'post'
AND to_days(p.post_date_gmt) >= to_days(now()) - 120
ORDER BY p.post_date DESC";


//DB Connect

$connection = mysql_connect($server, $user, $password);
mysql_select_db($dbName, $connection);
$res = mysql_query($query);

//XML Output

$xml = '<?xml version="1.0" encoding="UTF-8"?>
<standing version="1.0">';
while ($row = mysql_fetch_assoc($res)){
    $xml .= '
    <'.$row['object_id'].'>
      <term_taxonomy>'.$row['taxonomy'].'</term_taxonomy>
      <description>'.$row['description'].'</description>
      <post_date>'.$row['post_date_gmt'].'</post_date>
      <post_content>'.$row['post_content'].'</post_content>
      <post_title>'.$row['post_title'].'</pst_title>
      <post_exerpt>'.$row['post_exerpt'].'</post_exerpt>
    </'.$row['object_id'].'>
    ';
}
$xml.= '</standing>';


//Write to file

$file = 'News.xml'; 
if(is_file($file)) unlink($file);
$fp = fopen($file, "w+");
fwrite($fp, $xml);
fclose($fp);
mysql_close ($connection);
?>
InformationsquelleAutor Fry | 2011-07-05
Schreibe einen Kommentar