Wrox Programmer Forums
|
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 June 1st, 2004, 10:06 PM
Authorized User
 
Join Date: Jun 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default downloaded php program doesn't work

Hello,
I downloaded the code for "Content Management System" Ch.12 from web
http://www.wrox.com/dynamic/books/do...7582#downloads
for book "Beginning PHP, Apache, MySQL Web Development"
The program doesn't work correctly. I found a few errors, please help to solve them.
I have Windows 2000, Internet Explorer 6, IIS web server running and MYSQL4 and PHP4 installed.

The problems are:
I. (solved) in all files where you have "e-mail" word gives an error. So, I had to replace by "email" word.

II. (need you help)
in foloowing seven files my browser gives "undefined variable" errors on the lines:

1.file comment.php
line7 outputStory($_GET['article']);
line31 showComments($_GET['article'],FALSE);

2.file cpanel.php
line7 "WHERE user_id=" . $_SESSION['user_id'];

3.file compose.php
line47 if ($_SESSION['access_lvl'] < 2)

4.file admin
line19

5.file reviewarticle.php
line12 outputStory($_GET['article']);
line17 "WHERE article_id=" . $_GET['article'];

6.file search.php
line23 linewhile ($row = mysql_fetch_array($result))

7.file viewarticle.php
line6 outputStory($_GET['article']);
line8 showComments($_GET['article'],TRUE);

Please help to make program work correctly,
Thank you.
 
Old June 3rd, 2004, 03:11 AM
Authorized User
 
Join Date: May 2004
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry about the "e-mail" confusion. It seems the publisher did an automatic word-replace prior to publishing, and it affected the code.

In some cases, the code does not take into account that you may have error_reporting set to E_ALL. Check your php.ini file and check to see if error_reporting is set to E_ALL.

There are 3 ways to fix this problem:

1. Set error_reporting to E_ALL ^ E_NOTICE in your php.ini file.

2. If you don't have access to the php.ini file, or don't want to change it there, then you can set it at the beginning of your php page with the command:
  error_reporting(E_ALL ^ E_NOTICE);

3. You can fix the code to declare all variables that aren't already set. In the case of GET and POST variables, you'll need to check to see if they exist with isset(), then set them to a default value if isset() returns false.


Let us know if this doesn't fix your problems.

 
Old June 3rd, 2004, 12:47 PM
Authorized User
 
Join Date: Jun 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for the reply,
Could you please give me an example how to fix the code? There is a code for viewarticle.php (Ch.12) lines 6 and 8 gives error: 'article' not defined.

<?php
require_once 'conn.php';
require_once 'outputfunctions.php';
require_once 'header.php';

outputStory($_GET['article']);

showComments($_GET['article'],TRUE);

require_once 'footer.php';
?>
 
Old June 3rd, 2004, 06:59 PM
Authorized User
 
Join Date: May 2004
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default

What is the URL for that page? Copy it from your browser and paste it here.

My guess is that you are not supplying an article id. The URL should be something like:

Code:
http://www.yoursite.com/cms/viewarticle.php?article=2
If the "?article=x" part is left off, you'll get an error. To prevent that in the future, you should add code to check if article was passed, and if not, either set a default or return to the page they came from.

 
Old June 16th, 2004, 01:39 AM
Authorized User
 
Join Date: Jun 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello,
I found the problem why it didn't work: I had a misconfigured firewall on my computer.
Thank you.
 
Old June 16th, 2004, 10:17 AM
Authorized User
 
Join Date: May 2004
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Great :D

Glad I could help.

Michael K. Glass
Author, Beginning PHP, Apache, MySQL Web Development





Similar Threads
Thread Thread Starter Forum Replies Last Post
HOW to Run php program dimpleboy PHP How-To 7 January 22nd, 2015 12:40 AM
problem during execution of php program greenday Beginning PHP 2 November 12th, 2007 04:51 PM
can't get my program to work, help please nerdman978 C++ Programming 5 May 19th, 2007 05:11 AM
php does not work help!!! p2ptolu PHP How-To 2 March 23rd, 2005 03:51 AM





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