# Xml from mysql

**URL:** <https://forum.kirupa.com/t/xml-from-mysql/68142>\
**Category:** Uncategorized\
**Created:** [October 22, 2004, 10:16am UTC](https://forum.kirupa.com/t/xml-from-mysql/68142 "2004-10-22T10:16:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![benj](https://avatars.discourse-cdn.com/v4/letter/b/919ad9/32.png) [@benj](https://forum.kirupa.com/u/benj)\
**Post date:** [October 22, 2004, 10:16am UTC](https://forum.kirupa.com/t/xml-from-mysql/68142/1 "2004-10-22T10:16:20Z")

</div>

whats wrong with this

> 

\<?php  
header(“Content-type: text/xml”);  
require(“includes/db\_setup.php”);  
$query = “SELECT entryTitle, entryText FROM tblEntries”;  
$resultID = mysql\_query($query, $linkID) or die(“Data not found.”);  
$xml\_output = “\<?xml version="1.0"?\>  
“;  
$xml\_output .= “\<entries\>  
“;  
for($x = 0 ; $x \< mysql\_num\_rows($resultID) ; $x++){  
$row = mysql\_fetch\_assoc($resultID);  
$xml\_output .= " \<entry\>  
“;  
$xml\_output .= " \<entryTitle\>” . $row[‘entryTitle’] . “\</entryTitle\>  
“;  
// Escaping illegal characters  
$row[‘text’] = str\_replace(”&”, “&”, $row[‘entryText’]);  
$row[‘text’] = str\_replace(”\<”, “\<”, $row[‘entryText’]);  
$row[‘text’] = str\_replace(”\>”, “\>”, $row[‘entryText’]);  
$row[‘text’] = str\_replace(“"”, “"”, $row[‘entryText’]);  
$xml\_output .= " \<entryText\>" . $row[‘entryText’] . "\</entryText\>  
";  
$xml\_output .= " \</entry\>  
";  
}  
$xml\_output .= “\</entries\>”;  
echo $xml\_output;  
?\>

error cant see what ive done wrong !
