Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6
This is the forum to discuss the Wrox book Beginning PHP, Apache, MySQLWeb Development by Michael K. Glass, Yann Le Scouarnec, Elizabeth Naramore, Gary Mailer, Jeremy Stolz, Jason Gerner; ISBN: 9780764557446
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 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
  #1 (permalink)  
Old June 16th, 2004, 06:49 AM
Registered User
 
Join Date: Jun 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 1 page 74

I entered the following code as per the first "foreach" example on page 74 (down the bottom)...
<?php
$flavor[] = "blue raspberry";
$flavor[] = "root beer";
$flavor[] = "pineapple";
echo "My favorite flavors are:<br>";
foreach ($flavor, as $currentvalue) {
    // these lines will execute as long as there is a value in $flavour
    echo $currentvalue "<br>\n";
}
?>

When I open the php page I receive the following error...

Parse error: parse error, unexpected ',' in C:\Program Files\Apache Group\Apache2\test\array.php on line 6

I do not understand what I have done wrong.

Help!


David


  #2 (permalink)  
Old June 16th, 2004, 07:46 AM
Registered User
 
Join Date: Jun 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think I got it.

The code should have read...

<?php
$flavor[] = "blue raspberry";
$flavor[] = "root beer";
$flavor[] = "pineapple";
echo "My favorite flavors are:<br>";
foreach ($flavor as $currentvalue) {
    // these lines will execute as long as there is a value in $flavour
    echo "$currentvalue <br>\n";
}
?>

Works fine now.

David

  #3 (permalink)  
Old June 16th, 2004, 02:16 PM
Authorized User
 
Join Date: Apr 2004
Location: Cincinnati, OH, USA.
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for pointing that out- I will make sure it is included in the formal errata.



Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 3 Page 95 jumpot89 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 6 April 22nd, 2009 03:11 AM
Certification in Sharpoint Exam 74-133 Mujeeb Mehdi SharePoint Development 0 September 30th, 2007 10:51 PM
Chapter 3 - Page.IsCrossPagePostBack dpereira BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 9 October 25th, 2006 07:50 AM
chapter 3.0 try it out page 74 rat BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 5 August 3rd, 2006 01:51 PM





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