Wrox Programmer Forums
|
BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143
This is the forum to discuss the Wrox book Beginning PHP 6, Apache, MySQL 6 Web Development by Timothy Boronczyk, Elizabeth Naramore, Jason Gerner, Yann Le Scouarnec, Jeremy Stolz; ISBN: 9780470391143
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 4th, 2009, 12:05 AM
Registered User
 
Join Date: May 2009
Posts: 8
Thanks: 0
Thanked 1 Time in 1 Post
Exclamation Errata: Ch. 6, Page 157

Hi,

On page 157 (and the few follwing pages, based on the same code) there is this code:

PHP Code:
while ($row mysql_fetch_assoc($result)) {
       foreach (
$row as $value) {
           echo 
'<option value"' $row['movietype_id'] . '">';
           echo 
$row['movietype_label'] . '</option>';
       }
    } 

Now, I have no idea why we need this foreach statement, if we already fetched the row, and we are referring to it using array syntax.

Last edited by drupalmeister; June 4th, 2009 at 12:07 AM..
 
Old January 24th, 2010, 05:33 AM
Registered User
 
Join Date: Jan 2010
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Thumbs up Solution thanks. Errata ch6 p157

I had this error too and i its not in errata but it should be.

Thanks for solving this i thought the 'foreach' statements looked unnecessary.

Truth
 
Old September 27th, 2010, 10:08 AM
Authorized User
 
Join Date: Sep 2010
Posts: 20
Thanks: 0
Thanked 2 Times in 2 Posts
Default

I just ran into this problem today. The foreach statement results in 2 listings of each item. Kinda disturbing they'd put this in the book. Don't they know better?

By the way, where *is* the errata for this book? The only one I found on this site deals with minor typos and grammar, not code.
 
Old September 27th, 2010, 04:48 PM
Authorized User
 
Join Date: Aug 2010
Posts: 50
Thanks: 7
Thanked 0 Times in 0 Posts
Default

So instead of the foreach what should it be? please help. THansk.
 
Old September 27th, 2010, 04:51 PM
Authorized User
 
Join Date: Sep 2010
Posts: 20
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Just delete this:

foreach ($row as $value) {

and this:

}

Keep the echo stuff in between.
The Following User Says Thank You to bopjo1 For This Useful Post:
hozdaman (September 27th, 2010)
 
Old September 27th, 2010, 04:59 PM
Authorized User
 
Join Date: Aug 2010
Posts: 50
Thanks: 7
Thanked 0 Times in 0 Posts
Default

Thanks for your help!
 
Old September 27th, 2010, 05:33 PM
Authorized User
 
Join Date: Sep 2010
Posts: 20
Thanks: 0
Thanked 2 Times in 2 Posts
Default

you're welcome mate.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Errata: Ch. 6, Page 157 drupalmeister BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 June 3rd, 2009 08:28 PM
Page 35 Errata LongJohnSilver BOOK: Professional Visual Basic 2008 ISBN: 978-0-470-19136-1 2 January 9th, 2009 09:26 AM
Errata Page 664 Chrisull BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 November 24th, 2005 08:36 AM
Errata Page bonehead BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 2 June 27th, 2004 08:45 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.