# XML with php

**URL:** <https://forum.kirupa.com/t/xml-with-php/304319>\
**Category:** programming\
**Created:** [February 5, 2010, 9:57am UTC](https://forum.kirupa.com/t/xml-with-php/304319 "2010-02-05T09:57:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jehankokila](https://avatars.discourse-cdn.com/v4/letter/j/90ced4/32.png) [@jehankokila](https://forum.kirupa.com/u/jehankokila)\
**Post date:** [February 5, 2010, 9:57am UTC](https://forum.kirupa.com/t/xml-with-php/304319/1 "2010-02-05T09:57:16Z")

</div>

Hi,i am very new to XML,i want to use XML with php,this is the cord i used

\<?php  
$host = “localhost”;  
$user = “lanuage”;  
$pass = “testing”;  
$database = “xrandomusa\_4”;

$linkID = mysql\_connect($host, $user, $pass) or die(“Could not connect to host.”);  
mysql\_select\_db($database, $linkID) or die(“Could not find database.”);

$query = “SELECT \* FROM pages ORDER BY pageID DESC”;  
$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 .= " \<date\>” . $row[‘pageTitle’] . "\</text\>  
";  
// Escaping illegal characters

```
$xml_output .= " &lt;text&gt;" . $row['pageLink'] . "&lt;/text&gt;

```

";  
$xml\_output .= " \</entry\>  
";  
}

$xml\_output .= “\</entries\>”;

echo $xml\_output;  
?\>

its working nicely by the output from db,couldnt put to a tablenn:x,please let me know hw to use db output in html tables.:doh:
