Click to See Complete Forum and Search --> : Warning: Undefined Variable Error


Anon
03-30-2001, 08:24 PM
Just wondering why this is happening? I don't know if I have installed my php right.

Warning: Undefined variable: field_unique in D:\dev\phpMyAdmin\tbl_addfield.php on line 74

I get this on all MySQLadmin Pages and custom written code.

Does anyone think this is a PHP.INI problem and I'm too lame to figure it out?

Thanks for the help :)

Joseph Davis
sniperjoe@sniperjoe.com

vincente
03-31-2001, 12:44 PM
You somehow have set error_reporting to a higher value than usual.

All this means is that there is a variable being used before it was initialised (bad programming. Why? because if you don't initialise a var, it could theoretically contain anything, so it can't be trusted).

You can set this in php.ini or at runtime. Check out the manual about it.

Anon
04-02-2001, 12:18 PM
Yep that did it.

It was set to "ERROR_ALL"

Thanks :)

vincente
04-02-2001, 02:36 PM
By the way, switching off error-reporting is not always a good idea.
Sometimes the "undefined var" warning tells you you forgot a few statements somewhere...

Anon
08-14-2001, 03:34 AM
I was having the same problem. That worked for me as well.
It's really sad that the code is so poorly written that the errors need to be covered.
Thanks!

Anon
09-04-2001, 08:56 PM
Cool, I get the same warning on $PHP_SELF (below), how do I work around without changing the error_reporting level ?

print "<form method=\"post\" action=\"$PHP_SELF\">";

Anon
05-29-2002, 08:48 PM
I'm a total newbie, but this one worked for me...

<form method=post action="<?=$PHP_SELF?>">