Wrox Programmer Forums
|
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
 
Old June 30th, 2007, 04:42 PM
Registered User
 
Join Date: Oct 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default heredoc with period

On page 115 of the book I am receiving an error
Notice: Undefined variable: movie_details in ...table2.php on line 40
If I remove the period in the line "$movie_details .=<<<EOD" then the page loads as expected one entry to the table and without an error message. Roughly ten lines down in the file is a second heredoc written with a period style and that works without error.
With the period in the first heredoc the output from the file includes the three movie entries but then again shows the error message.
Has anyone else experienced this and how do I correct my syntax?

Namaste,
Kevin Tough

 
Old July 3rd, 2007, 11:57 AM
Friend of Wrox
 
Join Date: Dec 2003
Posts: 488
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hmmm. If php is like perl, then .= means take an existing variable and concatentate something with it (that's put it at the end of the existing string). As you haven't mentioned $movie_database before, it seems that your php interpreter is tripping over when it tries to add something to the end of it. So just initialize the variable first:

Code:
$movie_details = '';
$movie_details .=<<<EOD
--
Charlie Harvey's website - linux, perl, java, anarchism and punk rock: http://charlieharvey.org.uk





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to print the /Period/@dateFrom elayaraja.s XSLT 3 July 29th, 2008 04:19 AM
Celebrating the Golden Period of .NET DotnetEvangel ASP.NET 1.0 and 1.1 Basics 0 April 19th, 2008 12:28 AM
subtracting period columns in a matrix PhilVan Reporting Services 0 December 14th, 2006 09:57 AM
Calculate time period dtaya Access 1 July 26th, 2003 07:26 AM
RSEnableRemoteScripting and a period at top of pag lvinsel Javascript How-To 5 July 22nd, 2003 02:31 AM





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