Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
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 24th, 2005, 02:22 AM
Registered User
 
Join Date: Aug 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Code on table2.php

It seems i do more time debugging the code on this book than learning from it. Your codes just do not work. Why rush study books to market with lots of bugs.

Problem: Warning: extract() [function.extract]: First argument should be an array in /home/www.test.com/public_html/table2.php on line 37.

Im using Linux AS 4, Apache 1.33 , PHP 5.0.4 and MYSQL 5.04.
Code is listed below.


<?php
$link = mysql_connect("localhost","root","mysqlpass") or die(mysql_error());
     mysql_select_db("wiley") 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;

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);
     extract ($row_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'];

     //get director's name from people table
     get_director($movie_director);

     //get lead actor's name from people table
     get_leadactor($movie_leadactor);

     $movie_details .=<<<EOD
     <tr>
          <td>$movie_name</td>
          <td>$director</td>
          <td>$leadactor</td>
     </tr>
EOD;
     }


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

$movie_footer ="</table>";

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

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

 
Old April 13th, 2009, 07:31 PM
Authorized User
 
Join Date: Dec 2007
Location: greaternoida, u.p, India.
Posts: 65
Thanks: 9
Thanked 2 Times in 2 Posts
Send a message via AIM to sandeepgreaternoida Send a message via MSN to sandeepgreaternoida Send a message via Yahoo to sandeepgreaternoida
Default

yes these codes of table2-rev01.php is just very stupid they do not work....i have tried many times.........there must be some publishing error ..we must communicate this problem to the authors .
__________________
sandeep gupta




Similar Threads
Thread Thread Starter Forum Replies Last Post
table2.php in chapter 4 - blank page ?? redarrow BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 2 April 13th, 2009 07:27 PM
Querying table2 with results from table1 miamikk SQL Language 3 November 9th, 2006 09:22 AM
PHP code in the book aplav BOOK: Professional Ajax ISBN: 978-0-471-77778-6 1 September 3rd, 2006 08:28 AM
php - should i code my site with this? bennn Beginning PHP 6 November 25th, 2004 09:31 AM
"Insert into" close reopen table2 for display gilgalbiblewheel Classic ASP Databases 8 September 25th, 2004 06:05 PM





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