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 September 22nd, 2006, 11:50 AM
Registered User
Join Date: Aug 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Solution: Chapter 4, Table 2 Problems

Okay so this is so strange and it happened by accident but like a lot of others I was stuck on creating Table2 in Chapter 4. I mistakenly typed into my URL, this: http://localhost/table2.php
AND IT WORKED! Without the "\" it continued to show up blank but adding that "\" at the end made it display. This is so strange, but I kept checking and rechecking my code and it was all correct, I had no spaces after my EOD statements or anything. And this fixed it. Perhaps it will help others as well. This is what my code looks like:

$link = mysql_connect("localhost","root","password") 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);

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


function get_director() {
  global $movie_director;
  global $director;

  $query_d = "SELECT people_fullname " .
             "FROM people " .
             "WHERE people_id='$movie_director'";
  $results_d = mysql_query($query_d) or die(mysql_error());
  $row_d = mysql_fetch_array($results_d);
  extract ($row_d);
  $director = $people_fullname;

function get_leadactor() {
  global $movie_leadactor;
  global $leadactor;

  $query_a = "SELECT people_fullname " .
             "FROM people " .
             "WHERE people_id='$movie_leadactor'";
  $results_a = mysql_query($query_a) or die(mysql_error());
  $row_a = mysql_fetch_array($results_a);
  $leadactor = $people_fullname;

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



  $movie_details .=<<<EOD

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

$movie_footer = "</table>";

$movie =<<<MOVIE

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Solution to Chapter 20 Spasticus BOOK: Ivor Horton's Beginning Visual C++ 2005 1 January 26th, 2008 08:12 AM
problems with the reviews table in chapter 4 derrida BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 1 March 15th, 2007 03:58 AM
Solution: Chapter 4, Table 2 Problems amenne20 BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 September 22nd, 2006 11:48 AM
solution 1 in exercises in chapter 6 juan_forum BOOK: Beginning Java 2 0 September 16th, 2005 11:03 AM

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