este es el XML
<?xml version='1.0' encoding='UTF-8'?>
<library>
<book id="1">
<title>Fahrenheit 451</title>
<author>R. Bradbury</author>
<publisher>Del Rey</publisher>
</book>
<book id="2">
<title>The Silmarillion</title>
<author>J.R.R. Tolkien</author>
<publisher>G. Allen Unwin</publisher>
</book>
<book id="3">
<title>1984</title>
<author>G. Orwell</author>
<publisher>Signet</publisher>
</book>
<book id="4">
<title>Frankenstein</title>
<author>M. Shelley</author>
<publisher>Bedford</publisher>
</book>
<book id="5">
<title>The Moon Is a Harsh Mistress</title>
<author>R. A. Heinlein</author>
<publisher>Orb</publisher>
</book>
</library>
para mostrar todos los registros desde el archivo XML seria asi.
<?php
$library = simplexml_load_file( 'data.xml' );
echo '<table>';
echo '<tr>';
echo '<th>Title</th><th>Author</th><th>Publisher</th>';
echo '</tr>';
foreach( $library->book as $book ) {
echo '<tr>';
echo '<td>' . $book->title . '</td>';
echo '<td>' . $book->author . '</td>';
echo '<td>' . $book->publisher . '</td>';
echo '</tr>';
}
echo '</table>';
?>
ahora bien como haría para mostrar solo un registro.
desde una base datos mysql seria asi.
<?php
include 'config_db.php'
$id = 1;
$result = mysql_query("SELECT * FROM data WHERE id = $id");
$row = mysql_fetch_assoc($result);
echo $row["title"];
echo $row["author"];
echo $row["publisher"];
?>
![lloron](http://static.forosdelweb.com/fdwtheme/images/smilies/chillando.png)
![lloron](http://static.forosdelweb.com/fdwtheme/images/smilies/chillando.png)
![lloron](http://static.forosdelweb.com/fdwtheme/images/smilies/chillando.png)