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 18th, 2005, 09:11 PM
Authorized User
Join Date: Aug 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 10 - powers and enemies

I followed the book (entering the code) and input Powers to the char_power table.

Then I created the first and only Character choosing 1 or 2 powers. This character has no enemies. An error is thrown because $enemies is not defined in char_transact.php. (I copied the downloaded char_transact.php file so I did not create any typo errors.)

The statement - if($enemies != '') {
     then etc;

I fixed this with the following:
if (isset($enemies) && $enemies != '') {
Also if you update the character and do not select any Powers then $powers is undefined.

I changed - if($powers != "") {
to the following:
if (isset($powers) && $powers != "") {

In charlist.php I made the following change to skip $powers if it is not set (defined):

//$pow = ($powers[$row['id']]=='' ? 'none' :$powers[$row['id']]);
if(!isset($powers) || ($powers[$row['id']]== ''))
   $pow = 'none';
        $pow = $powers[$row['id']];

When I click the character link in charlist.php to edit my character charedit.php comes up with all the data filled in except there are no Powers selected. To make any update (or none at all) the Powers have to be re-selected. I have not figured out how to fix this.

I would be glad of help if somebody out there has the answer to this problem.


Similar Threads
Thread Thread Starter Forum Replies Last Post
chap10 - If a hero has no enemies bill_the_cat BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 May 25th, 2008 05:17 AM
Chapter 10 gogeo BOOK: Beginning Access 2003 VBA 1 January 22nd, 2006 09:41 AM
Chapter 10 czambran BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 2 March 29th, 2005 09:35 AM
Chapter 10 columbiasmiles JSP Basics 0 May 17th, 2004 08:09 PM

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