Jump to content

Archived

This topic is now archived and is closed to further replies.

Nickster

PHP Errors and a Possible Solution?

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

×

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.