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 December 23rd, 2005, 12:29 PM
Registered User
 
Join Date: Oct 2005
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 4: Table 2 (page116)

The table that comes up when using the code downloaded from here, or typing it in from the book, looks nothing like the table displayed on page 117. The table appears as it does on page 112, with the data right below it, not inside the table. I didn't see anything on this in the errata section. Anyone else having this problem? How do I fix it to make it look like it does on page 117?

thanks

Jim
 
Old December 25th, 2005, 04:24 PM
Registered User
 
Join Date: Oct 2005
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I fixed this. I forgot to remove <th>Movie Lead Actor</th>, <th>Movie Type</th>, and </table> from the revision.

Jim
 
Old February 12th, 2006, 05:00 AM
Registered User
 
Join Date: Feb 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This piece of code will not work for me at all

I just get a blank page? I've also tried the downloaded one, which does the same thing...

I've entered it as follows:

Code:
<?php

$link = mysql_connect("localhost", "bp5am", "bp5ampass")
    or die(mysql_error());

mysql_select_db("moviesite");
    or die(mysql_error());

$query= "SELECT movie_name, movie_director, movie_leadactor ".
    "FROM movie";

$result = mysql_query($query, $link)
    or die(mysql_error());
$num_movies = mysql_num_rows($result);

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

$movie_details = '';
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>&nbsp;</td>
    </tr>
    <tr>
        <td>Total: $num_movies Movies</td>
    </tr>
EOD;

$movie_footer ="</table>";

$movie = <<<MOVIE
    $movie_header
    $movie_details
    $movie_footer
MOVIE;

echo "There are $num_movies movies in our database";
echo $movie;

?>
"Those who do not believe in magic will never find it" - Roald Dahl
 
Old May 25th, 2006, 10:52 AM
Registered User
 
Join Date: Dec 2004
Posts: 9
Thanks: 0
Thanked 1 Time in 1 Post
Default

I am about to give up. I only get blank pages in this ¤&()"¤& chapter both when I write my own code and when I try to download the code. I've checked the erata and many posts at P2P.

My code is below and it corresponds with the book page 114-115.
I really wonder if just an end-tag for the table is missing </table>. Have tried to place it in various posistions with no succes.

I have no blanks, tabs or anything else after the =<<<EOD and the EOD;

Uh, I would be happy if someone can look through this I'm just a newbee to it all

<?php
$link = mysql_connect ("localhost", "root", "XXXXX")
    or die(mysql_error());
mysql_select_db ("moviesite")
    or die(mysql_error());
$query = "SELECT movie_name, movie_director, movie_leadactor " .
                    "FROM movie";

$result = mysql_query($query, $link)
    or die(mysql_error());
$num_movies = mysql_num_rows($result);

$movie_header=<<<EOD
<h2><center>Movie Review Database</center></h2>
<table width="70%" border="1" cellpadding="2"
       cellspacing="2" align="center">
  <tr>
    <th>Movie Title</th>
    <th>Year of Release</th>
    <th>Movie Director</th>
  </tr>
EOD;
$movie_details = '';
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;
?>

Hanne - Denmark
 
Old May 25th, 2006, 11:21 AM
Registered User
 
Join Date: Dec 2004
Posts: 9
Thanks: 0
Thanked 1 Time in 1 Post
Default

I gave up and went to page 116 there was the solution to the blank pages:

$movie_footer ="</table>";

$movie =<<<MOVIE
               $movie_header
               $movie_details
               $movie_footer
MOVIE;

  echo "There are $num_movies movies in our database";
  echo $movie;
?>

Best Regards,
Hanne B. Stegemüller - Denmark
 
Old December 16th, 2006, 11:18 PM
Authorized User
 
Join Date: Jul 2004
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Chudz
Default

HAHAHA :D






Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 4 - Table 2 ntonline1 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 1 April 16th, 2009 04:10 PM
Chapter 4 "Populating the Table" Chudz BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 4 August 24th, 2007 01:31 PM
Chapter 7 Purchases Table maxdigits BOOK: Beginning Ruby on Rails 0 December 23rd, 2006 12:25 PM
chapter 4 Table 2 alvinsimon BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 November 1st, 2005 10:34 AM





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