Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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..
Reply With Quote
  #2 (permalink)  
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
Reply With Quote
  #3 (permalink)  
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.
Reply With Quote
  #4 (permalink)  
Old September 27th, 2010, 04:48 PM
Authorized User
Points: 221, Level: 4
Points: 221, Level: 4 Points: 221, Level: 4 Points: 221, Level: 4
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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.
Reply With Quote
  #5 (permalink)  
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.
Reply With Quote
The Following User Says Thank You to bopjo1 For This Useful Post:
hozdaman (September 27th, 2010)
  #6 (permalink)  
Old September 27th, 2010, 04:59 PM
Authorized User
Points: 221, Level: 4
Points: 221, Level: 4 Points: 221, Level: 4 Points: 221, Level: 4
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2010
Posts: 50
Thanks: 7
Thanked 0 Times in 0 Posts
Default

Thanks for your help!
Reply With Quote
  #7 (permalink)  
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.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 11:20 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.