Jump to content


PHP Errors and a Possible Solution?

  • Please log in to reply
2 replies to this topic

#1 Nickster

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 03 April 2006 - 10:03 PM

Ok so I have been getting errors in my log files and most of them seem PHP related and I was wondering if you guys could help.

Here's the error:

[client **.**.*.**] PHP Notice: Use of undefined constant MSG_ADD - assumed 'MSG_ADD' in /var/www/ASG/lib/messages.php on line 5

And here is the way MSG_ADD is defined in messages.php

define(MSG_ADD,'Record Added Successfully.');

I was wondering if I change the code to this:

define('MSG_ADD','Record Added Successfully.');

would that correct the errors? Their are about 150 times that Define is used in messages.php and I want to be sure that, that solution would correct the problem before I go in and change things around? Thanks

#2 ToonMariner

  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 03 April 2006 - 10:19 PM

Yes. That will solve your problems.
follow me on twitter @PHPsycho

#3 wildteen88

  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 04 April 2006 - 11:18 AM

Notices are not errors. Errors stop your script from running how notices allow your script to continue. PHP notices are just telling you that something isn't correct however PHP was smart enaough to correct the issue as it assumed you meant 'var' instead of var.


PHP thinks you're are using a constant called var and not the index or key called var. This is why you should use quotes when you are using keys in an arrray or defining a variabled etc.

So if you use:
define('MSG_ADD','Record Added Successfully.');

You shouldn't get any notice messages by doing the above.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users