Wrox Programmer Forums
|
BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0
This is the forum to discuss the Wrox book Beginning PHP5, Apache, and MySQL Web Development by Elizabeth Naramore, Jason Gerner, Yann Le Scouarnec, Jeremy Stolz, Michael K. Glass; ISBN: 9780764579660
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 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 October 30th, 2008, 06:37 AM
Registered User
 
Join Date: Oct 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default undefined variable

Hi! I have been trying to learn this and have run into a wall. I typed the code exactly as in the book (pg 114-115) and I kept getting this error "unexpected .<<. I searched the web and found the source code. It looked the same so I just copied and pasted....just to see if it would work. It did, but now I get the error, "Undefined variable: movie_details. Below is the code I have, the var $movie_details is used twice and only the second one gives the error. If someone would assist me I would REALLY appreciate it!

while($row = mysql_fetch_array($result))
{
     $movie_name = $row['movie_name'];
     $movie_director = $row['movie_director'];
     $movie_leadactor = $row['movie_leadactor'];

     $movie_details .=<<<EOD
     <tr>
          <td>$movie_name</td>
          <td>$movie_director</td>
          <td>$movie_leadactor</td>
     </tr>
EOD;
}

      $movie_details .=<<<EOD
<tr>
     <td> </td>
</tr>
<tr>
     <td>Total :$num_movies Movies</td>
</tr>
EOD;

 
Old October 31st, 2008, 06:11 AM
Registered User
 
Join Date: Oct 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

As I was, the code available on the site is missing $movie_details = ''; just before the loop. I thought I'd write just in case I'm not the only one having this problem. Mine works great now!






Similar Threads
Thread Thread Starter Forum Replies Last Post
Undefined Variable aspire Beginning PHP 4 July 12th, 2006 07:00 AM
Undefined variable najib Beginning PHP 4 July 1st, 2005 08:12 AM
undefined variable !! cody44 Beginning PHP 3 January 20th, 2005 05:47 PM
Undefined Variable fpolan Beginning PHP 9 July 15th, 2004 06:24 AM
Undefined Variable Some Help! knight Beginning PHP 7 February 19th, 2004 07:07 AM





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