Re: Help: How do you get rid of these warnings for undefined variable s?

From: Date: Tue, 27 Mar 2001 16:24:57 +0000
Subject: Re: Help: How do you get rid of these warnings for undefined variable s?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-45737@lists.php.net to get a copy of this message
hi anyangwe, either define the variables or do what most people do and turn down error reporting. see : Reporting Errors : ------------------------------------------------------------- http://www.php.net/manual/en/phpdevel-errors.php pay special attention to E_NOTICE. for example, the following should give a similar errors with E_NOTICE on : print $array[index] // Always use quotes, looks for static variable // named 'index' first. 'make' in your case. // sidenote: something like $array[4] is good. if ($user == '') // Use isset or empty or something similar. print $notset; // "" if ($sumbit) // "" or don't depend on submit buttons. messing with empty variables is okay but use quotes around array index. always. except when index is a number (not associative). it works without but having php look for static variables first wastes energy and will cause unexpected results if it happens to exist. this is set in php.ini through error_reporting setting and also the following function has useful information within it : error_reporting -- set which PHP errors are reported : ------------------------------------------------------------- http://www.php.net/manual/en/function.error-reporting.php anyone have more information to share? please do. warm regards, philip On Tue, 27 Mar 2001, Anyangwe, Tanwani wrote: > Warning: Undefined index: make in C:\PHP\Test_Scripts\testdb3.php on line 16 > > Warning: Undefined variable: user in C:\PHP\Test_Scripts\testdb3.php on line > 5 > etc. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#45737) next »