Wrox Programmer Forums
|
BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143
This is the forum to discuss the Wrox book Beginning PHP 6, Apache, MySQL 6 Web Development by Timothy Boronczyk, Elizabeth Naramore, Jason Gerner, Yann Le Scouarnec, Jeremy Stolz; ISBN: 9780470391143
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143 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 February 19th, 2011, 02:01 PM
Registered User
 
Join Date: Feb 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 4 - Page 114-115 ERROR

Chapter 4 - Page 114-115

In the following code below there is $type_id. I looked every where but could not find where $type_id is being assigned from. I also checked the database but didn't find any fields named type_id.

therefore this could very well be a mistake. Instead of $type_id, It should be

$movie_id



PHP Code:
< ?php
// take in the id of a director and return his/her full name
function get_director($director_id) {
global 
$db;
$query â€˜SELECT
people_fullname
FROM
people
WHERE
people_id 
‘ $director_id;
$result mysql_query($query$db) or die(mysql_error($db));
$row mysql_fetch_assoc($result);
extract($row);
return 
$people_fullname;
}
// take in the id of a lead actor and return his/her full name
function get_leadactor($leadactor_id) {
global 
$db;
$query â€˜SELECT
people_fullname
FROM
people
WHERE
people_id 
‘ $leadactor_id;
$result mysql_query($query$db) or die(mysql_error($db));
$row mysql_fetch_assoc($result);
extract($row);
return 
$people_fullname;
}
// take in the id of a movie type and return the meaningful textual
// description
function get_movietype($type_id) {
global 
$db;
$query â€˜SELECT
movietype_label
FROM
movietype
WHERE
movietype_id 
‘ $type_id;
$result mysql_query($query$db) or die(mysql_error($db));
$row mysql_fetch_assoc($result);
extract($row);
return 
$movietype_label;
}
//connect to MySQL
$db mysql_connect(‘localhost’‘bp6am’‘bp6ampass’) or
die (
‘Unable to connectCheck your connection parameters.’);
// make sure you’re using the right database
mysql_select_db(‘moviesite’$db) or die(mysql_error($db));
// retrieve information
$query â€˜SELECT
movie_name
movie_yearmovie_directormovie_leadactor,
movie_type
FROM
movie
ORDER BY
movie_name ASC
,
movie_year DESC’;
$result mysql_query($query$db) or die(mysql_error($db));
// determine number of rows in returned result
$num_movies mysql_num_rows($result);
$table = < < < ENDHTML
Part I
Movie Review Web Site
116
div style=”text-aligncenter;” >
h2 Movie Review Database < /h2 >
table border=”1” cellpadding=”2” cellspacing=”2”
style
=”width70%; margin-leftautomargin-rightauto;” >
tr >
th Movie Title < /th >
th Year of Release < /th >
th Movie Director < /th >
th Movie Lead Actor < /th >
th Movie Type < /th >
< /
tr >
ENDHTML;
// loop through the results
while ($row mysql_fetch_assoc($result)) {
extract($row);
$director get_director($movie_director);
$leadactor get_leadactor($movie_leadactor);
$movietype get_movietype($movie_type);
$table .= < < < ENDHTML
tr >
td $movie_name < /td >
td $movie_year < /td >
td $director < /td >
td $leadactor < /td >
td $movietype < /td >
< /
tr >
ENDHTML;
}
$table .= < < < ENDHTML
< /table >
$num_movies Movies < />
< /
div >
ENDHTML;
echo 
$table
?>
 





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 4 pg 114 (Improving your Table) hozdaman BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143 1 September 5th, 2010 03:25 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
Error: Chapter 3 (try it out) page 85 dea0303 BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 August 29th, 2006 05:47 PM
Chapter 9 Try It Out Error, page 325 VictorVictor BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 3 March 22nd, 2006 02:22 PM
Chapter 4 pg. 114-115 mjc2928 BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 4 August 25th, 2004 07:09 AM





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