Jump to content

PHP Errors and a Possible Solution?


Nickster

Recommended Posts

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
Link to comment
Share on other sites

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.

$_GET[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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.