I am wondering the importance of a notice error on an undefined variable, or rather the importance of having an undefined variable, I know it get the error as I have the php.ini file set to show all errors including notice errors (I am testing locally). How important is this? is it something I should ignore by setting my ini file to not show Notices?
I remember reading that it wasn't needed to define a php veriable but if that is the case then why would this error exit?
The notce error:
Notice: Undefined variable: at in /Users/mikebr/Sites/_CONFIGURE.php on line 68
Thanks
Undefined variable notice question
Moderator: General Moderators
-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA
Could you maybe show us the code?
Adding to a variable like so:
Isn't a really big deal, as long as it works.
However, doing something like this:
IS, since it would mean the query wouldn't execute due to the variable not being there.
I'd always suggest making sure you know where it's coming from and that it's initialized.
Adding to a variable like so:
Code: Select all
<?php
$uvar .= "new text.<br />";
?>However, doing something like this:
Code: Select all
<?php
mysql_query($uvar);
?>I'd always suggest making sure you know where it's coming from and that it's initialized.
OK, I am testing locally but it would move to production eventually.
I wouldn't be using the variable as part of a query. What is happening is that I have code at the top of my page such as:
If there is no user alert then I get the Undefined notice, but the user alert would only exist if there was a user alert, normally there wouldn't be.
Thanks
I wouldn't be using the variable as part of a query. What is happening is that I have code at the top of my page such as:
Code: Select all
<?php
if ($userAlert) {
print "$userAlert";
}
?>Thanks
-
djot
-
Code: Select all
<?php
if (isset($userAlert)) {
print "$userAlert";
}
?>-