Hello,
I have sucessfull followed this tutorial
http://www.phpfreaks.com/tutorial/handling-xml-data
and used xpath to find the books I need, here is my code
Code: [Select]<?php
// load SimpleXML
$books = new SimpleXMLElement('books.xml', null, true);
echo <<<EOF
<table>
<tr>
<th>Title</th>
<th>Author</th>
<th>Publisher</th>
<th>Price at Amazon.com</th>
<th>ISBN</th>
</tr>
EOF;
foreach($books->xpath('book1/book') as $book) // loop through our books
{
echo <<<EOF
<tr>
<td>{$book->title}</td>
<td>{$book->author}</td>
<td>{$book->publisher}</td>
<td>${$book->amazon_price}</td>
<td>{$book['isbn']}</td>
</tr>
EOF;
}
echo '</table>';
?>
now I want to only show the first 5 books in the xml file as it is updated regularly
I can't seem to figure out how to do this.
any help would be great , thanks
Code working in IE but not FireFox
I created a dynamic navigation list for my website based off of a table in my database. The code is working perfectly in IE (I have version 8 on this computer) But it wont work on Firefox. I'm not
Preg_match unknown modifyer
Hello,Im trying to write a little script for my forums i need to get the reply from my forums. Im trying thisCode: $pattern = '/<span
Drop Down and text box issue
Is it possible to set a drop down list and text boxes to a certain width?here is my codeCode: [Select]echo "<select name='categories'>"; echo "<option
Staff Induction System - No idea where to go from here!!!
Hi there, I'm pretty new to PHP and Mysql so could really do with being pointed in the right direction with this problem I have.I am trying to set up a system induct new members of staff onto their
Need help making login verification cleaner...
I use the below to verify user login. I first check the cookie for the id, ip and a unique id. If it's set then I move on to verifying that they all belong together. I usually copy and paste
MySQL issue
I am taking sentences through a form on page. Then checking some condition and trying to insert them in database. I have issues while inserting...foreach ($sentences as $final) {......else {
str_replace help
Hey there,I'm a PHP newb, I'm having troubles with the str_replace function. I want to clean up bad html to valid xhtml, I am using:Code: $pee = str_replace('&', '&amp;', $pee);It
WELCOME SCREEN
first of all let me tell you what does my script do, it´s a very simple query to show a email from a database, (EX: Welcome: user@server.com). i get the email whit the id.
RTF fomatting to email content
Im trying to sen an email with content is picked up from a rtf-file (file_get_contents('*.rtf'). Mail is sent correctly, but the formatting of the content includes rtf formatting like:
how to remove in php string display
My code is$message="We're looking at developing our website.";$body= "My message is,\n\n\n\n\t\t\t".$message";echo $body;I get result We\'re looking at developing our