Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 18th, 2003, 07:21 AM
Authorized User
 
Join Date: Nov 2003
Location: Trowbridge, Wilts, United Kingdom.
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default php/mysql programming problem - design - solution

suprise suprise, more problems with this book!!!

I'm starting to get somewhere but I'm still having loads of problems :-(
On inspecting the error_log of Apache, for every page request I get all these notices, which, I'm hazarding a guess isn't what's suppose to be happening!

Code:
[Tue Nov 18 11:08:03 2003] [error] PHP Notice:  A session had already been started - ignoring session_start() in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 68
[Tue Nov 18 11:08:03 2003] [error] PHP Notice:  Undefined index:  cursor in /Library/WebServer/Documents/wrox_site/core/tpl_secure.php on line 27
[Tue Nov 18 11:08:04 2003] [error] PHP Notice:  Use of undefined constant version - assumed 'version' in /Library/WebServer/Documents/wrox_site/core/tpl_secure.php on line 40
[Tue Nov 18 11:08:04 2003] [error] PHP Notice:  Undefined variable:  sReturn in /Library/WebServer/Documents/wrox_site/_lib/_base/elements.php on line 36
[Tue Nov 18 11:08:04 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:04 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:04 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:04 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:04 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:04 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:04 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:04 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:04 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:04 2003] [error] PHP Notice:  Undefined variable:  aProduct in /Library/WebServer/Documents/wrox_site/core/products/form.php on line 228
[Tue Nov 18 11:08:04 2003] [error] PHP Notice:  A session had already been started - ignoring session_start() in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 68
[Tue Nov 18 11:08:04 2003] [error] PHP Notice:  Undefined index:  op in /Library/WebServer/Documents/wrox_site/core/tpl_secure.php on line 25
[Tue Nov 18 11:08:04 2003] [error] PHP Notice:  Undefined index:  id in /Library/WebServer/Documents/wrox_site/core/tpl_secure.php on line 26
[Tue Nov 18 11:08:04 2003] [error] PHP Notice:  Undefined index:  cursor in /Library/WebServer/Documents/wrox_site/core/tpl_secure.php on line 27
[Tue Nov 18 11:08:04 2003] [error] PHP Notice:  Undefined variable:  sFilter in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.products.php on line 325
[Tue Nov 18 11:08:04 2003] [error] PHP Notice:  Use of undefined constant version - assumed 'version' in /Library/WebServer/Documents/wrox_site/core/tpl_secure.php on line 40
[Tue Nov 18 11:08:04 2003] [error] PHP Notice:  Undefined variable:  sReturn in /Library/WebServer/Documents/wrox_site/_lib/_base/elements.php on line 36
[Tue Nov 18 11:08:04 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:04 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:04 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:04 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:04 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:04 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:04 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:04 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:04 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:04 2003] [error] PHP Notice:  Undefined variable:  bg in /Library/WebServer/Documents/wrox_site/_lib/_base/elements.php on line 85
[Tue Nov 18 11:08:18 2003] [error] PHP Notice:  A session had already been started - ignoring session_start() in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 68
[Tue Nov 18 11:08:18 2003] [error] PHP Notice:  Undefined index:  cursor in /Library/WebServer/Documents/wrox_site/core/tpl_secure.php on line 27
[Tue Nov 18 11:08:18 2003] [error] PHP Notice:  Use of undefined constant version - assumed 'version' in /Library/WebServer/Documents/wrox_site/core/tpl_secure.php on line 40
[Tue Nov 18 11:08:18 2003] [error] PHP Notice:  Undefined variable:  sReturn in /Library/WebServer/Documents/wrox_site/_lib/_base/elements.php on line 36
[Tue Nov 18 11:08:18 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:18 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:18 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:18 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:18 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:18 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:18 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:18 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:18 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:21 2003] [error] PHP Notice:  A session had already been started - ignoring session_start() in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 68
[Tue Nov 18 11:08:21 2003] [error] PHP Notice:  Undefined index:  cursor in /Library/WebServer/Documents/wrox_site/core/tpl_secure.php on line 27
[Tue Nov 18 11:08:21 2003] [error] PHP Notice:  Use of undefined constant version - assumed 'version' in /Library/WebServer/Documents/wrox_site/core/tpl_secure.php on line 40
[Tue Nov 18 11:08:21 2003] [error] PHP Notice:  Undefined variable:  sReturn in /Library/WebServer/Documents/wrox_site/_lib/_base/elements.php on line 36
[Tue Nov 18 11:08:21 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:21 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:21 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:21 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:21 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:21 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:21 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:21 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:21 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:21 2003] [error] PHP Notice:  Undefined variable:  aProduct in /Library/WebServer/Documents/wrox_site/core/products/form.php on line 228
[Tue Nov 18 11:08:21 2003] [error] PHP Notice:  A session had already been started - ignoring session_start() in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 68
[Tue Nov 18 11:08:21 2003] [error] PHP Notice:  Undefined index:  op in /Library/WebServer/Documents/wrox_site/core/tpl_secure.php on line 25
[Tue Nov 18 11:08:21 2003] [error] PHP Notice:  Undefined index:  id in /Library/WebServer/Documents/wrox_site/core/tpl_secure.php on line 26
[Tue Nov 18 11:08:21 2003] [error] PHP Notice:  Undefined index:  cursor in /Library/WebServer/Documents/wrox_site/core/tpl_secure.php on line 27
[Tue Nov 18 11:08:21 2003] [error] PHP Notice:  Undefined variable:  sFilter in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.products.php on line 325
[Tue Nov 18 11:08:21 2003] [error] PHP Notice:  Use of undefined constant version - assumed 'version' in /Library/WebServer/Documents/wrox_site/core/tpl_secure.php on line 40
[Tue Nov 18 11:08:21 2003] [error] PHP Notice:  Undefined variable:  sReturn in /Library/WebServer/Documents/wrox_site/_lib/_base/elements.php on line 36
[Tue Nov 18 11:08:21 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:21 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:21 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:21 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:21 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:21 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:21 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:21 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:21 2003] [error] PHP Notice:  Undefined index:  admin_app_perm in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 301
[Tue Nov 18 11:08:21 2003] [error] PHP Notice:  Undefined variable:  bg in /Library/WebServer/Documents/wrox_site/_lib/_base/elements.php on line 85
[Tue Nov 18 11:08:35 2003] [error] PHP Notice:  Undefined index:  op in /Library/WebServer/Documents/wrox_site/site/tpl_unsecure.php on line 9
[Tue Nov 18 11:08:35 2003] [error] PHP Notice:  Undefined index:  id in /Library/WebServer/Documents/wrox_site/site/tpl_unsecure.php on line 10
[Tue Nov 18 11:08:35 2003] [error] PHP Notice:  Undefined index:  cursor in /Library/WebServer/Documents/wrox_site/site/tpl_unsecure.php on line 11
[Tue Nov 18 11:08:35 2003] [error] PHP Notice:  Undefined variable:  sFilter in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.products.php on line 325
[Tue Nov 18 11:08:35 2003] [error] PHP Notice:  Undefined variable:  sReturn in /Library/WebServer/Documents/wrox_site/_lib/_base/elements.php on line 36
[Tue Nov 18 11:08:35 2003] [error] PHP Notice:  Undefined variable:  iType in /Library/WebServer/Documents/wrox_site/site/products/index.php on line 61
[Tue Nov 18 11:08:35 2003] [error] [client 127.0.0.1] File does not exist: /Library/WebServer/Documents/wrox_site/_img/banners/lg_blank.gif
[Tue Nov 18 11:08:39 2003] [error] PHP Notice:  Undefined index:  op in /Library/WebServer/Documents/wrox_site/site/tpl_unsecure.php on line 9
[Tue Nov 18 11:08:39 2003] [error] PHP Notice:  Undefined index:  id in /Library/WebServer/Documents/wrox_site/site/tpl_unsecure.php on line 10
[Tue Nov 18 11:08:39 2003] [error] PHP Notice:  Undefined index:  cursor in /Library/WebServer/Documents/wrox_site/site/tpl_unsecure.php on line 11
[Tue Nov 18 11:08:39 2003] [error] PHP Notice:  Undefined variable:  sFilter in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.products.php on line 325
[Tue Nov 18 11:08:39 2003] [error] PHP Notice:  Undefined variable:  sReturn in /Library/WebServer/Documents/wrox_site/_lib/_base/elements.php on line 36
[Tue Nov 18 11:08:39 2003] [error] PHP Notice:  Undefined variable:  iType in /Library/WebServer/Documents/wrox_site/site/products/index.php on line 61
[Tue Nov 18 11:08:39 2003] [error] [client 127.0.0.1] File does not exist: /Library/WebServer/Documents/wrox_site/_img/banners/lg_blank.gif
[Tue Nov 18 11:08:46 2003] [error] PHP Notice:  Undefined index:  op in /Library/WebServer/Documents/wrox_site/site/tpl_unsecure.php on line 9
[Tue Nov 18 11:08:46 2003] [error] PHP Notice:  Undefined index:  id in /Library/WebServer/Documents/wrox_site/site/tpl_unsecure.php on line 10
[Tue Nov 18 11:08:46 2003] [error] PHP Notice:  Undefined index:  cursor in /Library/WebServer/Documents/wrox_site/site/tpl_unsecure.php on line 11
[Tue Nov 18 11:08:46 2003] [error] PHP Notice:  Undefined variable:  sFilter in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.products.php on line 325
[Tue Nov 18 11:08:46 2003] [error] PHP Notice:  Undefined variable:  sReturn in /Library/WebServer/Documents/wrox_site/_lib/_base/elements.php on line 36
[Tue Nov 18 11:08:46 2003] [error] PHP Notice:  Undefined variable:  iType in /Library/WebServer/Documents/wrox_site/site/products/index.php on line 61
[Tue Nov 18 11:08:46 2003] [error] [client 127.0.0.1] File does not exist: /Library/WebServer/Documents/wrox_site/_img/banners/lg_blank.gif
[Tue Nov 18 11:08:47 2003] [error] PHP Notice:  Undefined index:  op in /Library/WebServer/Documents/wrox_site/site/tpl_unsecure.php on line 9
[Tue Nov 18 11:08:47 2003] [error] PHP Notice:  Undefined index:  cursor in /Library/WebServer/Documents/wrox_site/site/tpl_unsecure.php on line 11
[Tue Nov 18 11:08:47 2003] [error] PHP Notice:  Undefined variable:  sReturn in /Library/WebServer/Documents/wrox_site/_lib/_base/elements.php on line 36
[Tue Nov 18 11:08:47 2003] [error] [client 127.0.0.1] File does not exist: /Library/WebServer/Documents/wrox_site/_img/banners/lg_blank.gif
[Tue Nov 18 11:08:49 2003] [error] PHP Notice:  Undefined index:  op in /Library/WebServer/Documents/wrox_site/site/tpl_unsecure.php on line 9
[Tue Nov 18 11:08:49 2003] [error] PHP Notice:  Undefined index:  id in /Library/WebServer/Documents/wrox_site/site/tpl_unsecure.php on line 10
[Tue Nov 18 11:08:49 2003] [error] PHP Notice:  Undefined index:  cursor in /Library/WebServer/Documents/wrox_site/site/tpl_unsecure.php on line 11
[Tue Nov 18 11:08:49 2003] [error] PHP Notice:  Undefined variable:  sFilter in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.products.php on line 325
[Tue Nov 18 11:08:49 2003] [error] PHP Notice:  Undefined variable:  sReturn in /Library/WebServer/Documents/wrox_site/_lib/_base/elements.php on line 36
[Tue Nov 18 11:08:49 2003] [error] PHP Notice:  Undefined variable:  iType in /Library/WebServer/Documents/wrox_site/site/products/index.php on line 61
[Tue Nov 18 11:08:49 2003] [error] [client 127.0.0.1] File does not exist: /Library/WebServer/Documents/wrox_site/_img/banners/lg_blank.gif
What is an 'Undefined index' can't seem to find the answer easily on php.net (or with google) and why am I getting them ??? Also, I keep getting an error saying call to undefined function: isError() but PEAR is all setup, and my include_path is definately pointing at the PEAR dir, aaarrrrgggghhhhh!!

Anyone have a an idea what's going on here? ?? It would be nice, really nice, if the authors were around here as I'm sure they'd know exactly what was going on. I really don't want to go through the book without having the test site setup and working perfectly, it makes debugging my own work much harder.

Thanks as ever,

Jon
Reply With Quote
  #2 (permalink)  
Old November 18th, 2003, 07:47 AM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

You're getting all of these errors because you have PHP set to display notice level errors. In a nut shell that means that if you use a variable without defining it first it'll throw a notice level error. That includes undefined array indices as well as undefined constants.

Have the error level set to E_ALL will include notice level errors. The benefits of this allows a more explicit execution of code and also has incredible benefits for the debugging process. PHP will tell you when you don't have a variable defined where you may want one defined.

You can get around these errors by writing your code more explicitly. By using basic constructs like isset() or empty().

Checks for a variable's existence without throwing a notice
http://www.php.net/isset

Checks for a variable's value without throwing a notice (there is a difference!) If true, empty checks for a false, null, zero or string zero value "0". If false it looks for the opposite. Whereas isset only looks for a variable's existence.
http://www.php.net/empty

This error:
[Tue Nov 18 11:08:04 2003] [error] PHP Notice: A session had already been started - ignoring session_start() in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.session.php on line 68
You're getting because you are making a second call to session_start() somewhere in your script.

This error:
[Tue Nov 18 11:08:49 2003] [error] PHP Notice: Undefined index: id in /Library/WebServer/Documents/wrox_site/site/tpl_unsecure.php on line 10
Expects an array with associative indice "id" to already be set.

Also undefined offset will be the same thing but it will be talking about numeric indices.

And if you want to supress the notice level errors you can do so by changing the value of error_reporting in php.ini or at runtime with ini_set()

http://www.php.net/ini_set

Its helpful to have error reporting set to include notice level errors so I suggest getting accustomed to dealing with them with code rather than supressing them. Otherwise its not *really* going to hurt anything to supress them... that is unless the existence of the variable is crucial to the script's operation and supressing errors at that point would leave you in the dark.

You're getting these errors in a pear library?? That seems unusual to me. I would verify that you have all the necessary components. Perhaps you could let us know what library and how you are trying to use it with some code examples.

: )
Rich

:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::
Reply With Quote
  #3 (permalink)  
Old November 18th, 2003, 08:05 AM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Here is a link that talks about the security benefits of error_reporting = E_ALL
http://www.php.net/manual/en/security.errors.php

Quote:
quote:
 I keep getting an error saying call to undefined function: isError()
Every pear library I've worked with is set-up as a class. Maybe you haven't properly instantiated the class?

Awaiting some code to speculate further!

: )
Rich

:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::
Reply With Quote
  #4 (permalink)  
Old November 18th, 2003, 08:18 AM
Authorized User
 
Join Date: Nov 2003
Location: Trowbridge, Wilts, United Kingdom.
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

HI Rich,

Ok, so these are more warnings than errors ?? but I'm guessing that all these missing vars will cause all sorts of problems ??? Is there any reason why I should be getting soo many errors from the source caode from this book ??? Seems a little crappy doesn't it, seeing as I haven't changed anything other than a few things in the config file, surely these vars should be passed by the scripts without any help from me. the entire site's source files can be found here <http://www.apress.com/ApressCorporate/supplement/1/200/159059150X-1182.zip> I know it's a well big ask to expect you to look through all the code without the book but it's worth a try!

Certain areas seem to work ok, others have strange bugs.

Code:
function accounts($iAccountId = '') {

        // implement pear mail object
        $this->_oMail =& Mail::factory("mail");

        if (Mail::isError($this->_oMail)) { // this is line 58!

            catchExc($this->_oMail->getMessage());
        }
this relates to the error: PHP Fatal error: Call to undefined function: iserror() in /Library/WebServer/Documents/wrox_site/_lib/_classes/class.accounts.php on line 58

Any ideas ???

jon
Reply With Quote
  #5 (permalink)  
Old November 18th, 2003, 08:20 AM
Authorized User
 
Join Date: Nov 2003
Location: Trowbridge, Wilts, United Kingdom.
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

could it be that the PEAR class Mail.php hasn't been included ??? that would seem odd as there's nothing in the logs refering to an unknown file.

jon
Reply With Quote
  #6 (permalink)  
Old November 18th, 2003, 08:23 AM
Authorized User
 
Join Date: Nov 2003
Location: Trowbridge, Wilts, United Kingdom.
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

is there a simple way to test this outside of the main sites scripts ??? something like this ?

Code:
<?php

require_once("Mail.php");
require_once("DB.php");

var $_oMail;

$this->_oMail =& Mail::factory("mail");
        
if (Mail::isError($this->_oMail)) { // this is line 58!

    echo($this->_oMail->getMessage());
}

?>
????

Jon
Reply With Quote
  #7 (permalink)  
Old November 18th, 2003, 08:26 AM
Authorized User
 
Join Date: Nov 2003
Location: Trowbridge, Wilts, United Kingdom.
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

why do I get a parse error for this line ???

var $_oMail;

can't see anything wrong with it ? weird!
Reply With Quote
  #8 (permalink)  
Old November 18th, 2003, 08:32 AM
Authorized User
 
Join Date: Nov 2003
Location: Trowbridge, Wilts, United Kingdom.
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

and... why can't I find any documentation about this "=&" operator ???? what is it ?? what does it do ???

jon
Reply With Quote
  #9 (permalink)  
Old November 18th, 2003, 08:59 AM
Authorized User
 
Join Date: Nov 2003
Location: Trowbridge, Wilts, United Kingdom.
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I get this error:

[cpde][Tue Nov 18 12:57:46 2003] [error] PHP Notice: Undefined variable: _oMail in /Library/WebServer/Documents/wrox_site/mail_test.php on line 10
[Tue Nov 18 12:57:46 2003] [error] PHP Fatal error: Call to undefined function: iserror() in /Library/WebServer/Documents/wrox_site/mail_test.php on line 15[/code]

with this script:

Code:
<?php

require_once("Mail.php");
require_once("DB.php");

function mailTest(){

    echo "mailTest() called!";

    $_oMail;

    // implement pear mail object
    $_oMail =& Mail::factory("mail");

    if (Mail::isError($_oMail)) {

        echo($_oMail->getMessage());

    }
}

mailTest();

?>
but I don't get any errors regarding a missing include file, is this a PEAR problem!!!!! (sorry to kee banging on about it) I only ask because isError() is a method of the PEAR class, so maybe I'm not including the main pear class, and if I was all this would be sorted!!!!!

Jon
Reply With Quote
  #10 (permalink)  
Old November 18th, 2003, 09:00 AM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Well the cold hard truth is the book is probably written that badly. My guess is it probaby won't hurt anything to surpress the notice errors just to see the book's code in action.

Have you used Pear before? I'm not on the up and up on Pear. I did some fooling with the .mp3 parsing library. I know I had to go through all this extra installation business to install it on Windows. And then I downloaded the library I wanted to use and included it and used it like any other class.

This line is proper syntax, but you aren't using it from within the context of a class, so PHP is choking on it.
var $_oMail;

Of course you can test your script outside the context of the book's code.. you just need to understand all the required arguments.

I'm thinking "=&" is a shortcut of some kind for instantiating a class, I could be wrong about that.

This looks like its expected to be written and created within a class. You're creating a static variable and then instantiating an instance of the pear mailer class and storing it in that static variable. But this code isn't structed in a class. '$this->' is used inside of a class to refer to an object or method of that class. Its allows the class to talk to itself.

Code:
<?php

require_once("Mail.php");
require_once("DB.php");

var $_oMail;

$this->_oMail =& Mail::factory("mail");

if (Mail::isError($this->_oMail)) { // this is line 58!

    echo($this->_oMail->getMessage());
}

?>
Lemme have a look at the source code for this so I can get an understanding of what's going on and I'll get back to you.

If you're using the book's source code as it was without modification and are getting all of these errors, then maybe something is wrong with how pear is set-up. Again lemme do a little research about it and I'll get back with you.

: )
Rich

:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows based Problem Design Solution Book ricpue BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 5 September 1st, 2006 07:47 AM
php-mysql website - problem design solution pannet1 Pro PHP 0 December 23rd, 2005 01:49 PM
php/mysql programming problem - design - solution jben.net Beginning PHP 8 November 14th, 2003 09:00 PM
PHP MySQL Website Programming P-D-S robmorrish All Other Wrox Books 1 August 5th, 2003 01:29 AM
Building a PHP Intranet Problem-Design-Solution kseba All Other Wrox Books 0 June 23rd, 2003 04:26 PM



All times are GMT -4. The time now is 07:21 PM.


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