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 August 23rd, 2004, 08:56 PM
Registered User
 
Join Date: Aug 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 4 pg. 114-115

I just can't see where the problem is here, I have retyped the code twice and I am getting the same error:

"Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\Program Files\Apache Group\Apache2\test\table1.php on line 27"

From a google search of the error, I found that it usually indicates an extra quotation or incorrect usage of quotations, but I don't see where it is ocurring:

24 EOD;
25 while($row = mysql_fetch_array($result))
26 {
27 $movie_name = $row['movie_name'];
28 $movie_director = $row['movie_director'];

could it be something else?
Thanks in advance.

-Mike

 
Old August 24th, 2004, 06:59 PM
Registered User
 
Join Date: Aug 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am getting a lot of looks, but no replies, maybe with more code, someone can see something I am not? Thanks for any input.

-Mike

1 <?php
2 $link = mysql_connect("localhost", "root", "phpdatabas3") or die(mysql_error());
3
4 mysql_select_db("wiley") or die (mysql_error());
5
6 $query = "SELECT
7 movie_name,
8 movie_director,
9 movie_leadactor,
10 FROM
11 movie";
12 $result = mysql_query($query,$link) or die(mysql_error());
13
14 $num_movies = mysql_num_rows($result);
15
16 $movie_header =<<<EOD
17 <h2><center>Movie Review Database</center></h2>
18 <table width='70%' border='1' cellpadding='2' cellspacing='2' align='center'>
19 <tr>
20 <th align='left'>Movie Title</th>
21 <th align='left'>Movie Director</th>
22 <th align='left'>Movie Lead Actor</th>
23 </tr>
24 EOD;
25 while($row = mysql_fetch_array($result))
26 {
27 $movie_name = $row['movie_name'];
28 $movie_director = $row['movie_director'];

 
Old August 24th, 2004, 07:23 PM
Registered User
 
Join Date: Aug 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to nmwebs
Default

I just typed a whole bunch of possible answers, tested my own answers, and then lost everything I typed, but that's okay, I figured out your problem.

WHITE SPACE

I remember something in the book saying that you can't have spaces around you EOD or else you'll spend HOURS trying to debug it. Guess what? I copy/pasted your code and you have spaces after your EOD. Try replacing the following lines with these:

$movie_header =<<<EOD
       <h2><center>Movie Review Database</center></h2>
       <table width='70%' border='1' cellpadding='2' cellspacing='2' align='center'>
        <tr>
           <th align='left'>Movie Title</th>
           <th align='left'>Movie Director</th>
          <th align='left'>Movie Lead Actor</th>
        </tr>
EOD;

I know this isn't grammatically correct for good, healthy, organized code, but I didn't want to take any chances so I deleted the spaces BEFORE EOD as well.

Hope this helps you out.

Shawn
NMWebs
www.nmwebs.com
 
Old August 24th, 2004, 09:57 PM
Registered User
 
Join Date: Aug 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Evil, evil Dreamweaver, you have caused my hours of torture. I originally thought that was the issue, attempted to correct it using DW, and it continued making the error.

Anyone with similar problems; I made the EOD, next line, and previous line flush with the left side of the text editor and deleted any possible white space:

</tr>
EOD;
while($row = mysql_fetch_array($result))

There is also a MySQL error in my code (remove the comma):
9 movie_leadactor

Thank you Shawn, are you hiring :)

 
Old August 25th, 2004, 07:09 AM
Registered User
 
Join Date: Aug 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to nmwebs
Default

I wish I had enough clients to be able to hire employees. Hopefully some day.

Anywho, now that I've helped you with yours, you have to help me with mine! :D

I've posted my issue as a reply to someone else who was having the same issue, but nobody posted an answer. It's just a few topics below this one; I think it's named "Query was empty."

I read through chapter 4 and 5 without doing any of the work, but then I thought I could at least go through and do the work, so I started to, and at the end of Chapter 4, it got all screwed up. It's just saying "Query was empty" when I click on one of the links. I even did a data dump, and lo and behold, somehow the query really IS empty. Anyway, I expect you to run across it any day now, since it's only a few pages past where you are now, and then you'll help me, right? ;)

Shawn
NMWebs
www.nmwebs.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 3 pg 95 al2000 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 2 August 4th, 2008 09:18 PM
Chapter 4 Pg 117 Try It Out workib ASP.NET 3.5 Basics 1 April 7th, 2008 12:49 AM
chapter 5, pg 154 spizotfl BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 3 May 1st, 2007 03:08 PM
Answer to the nightmare on pages 114, 115, 116, mobyme BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 1 April 23rd, 2007 07:53 PM
Chapter 4 pg 131 cpkaiser BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 3 May 2nd, 2004 01:50 PM





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