Home  >  Article  >  Backend Development  >  PHP error Notice: Undefined index solution_PHP tutorial

PHP error Notice: Undefined index solution_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 14:54:001473browse

I set error_reporting to E_ALL.

When reading data, such as $row['name']

There will be many Notice: Undefined index: errors,

What should I do? error_reporting(E_ALL & ~ E_NOTICE ) Is this like this?

Undefined index: It means that there is an error in your code: "The variable has not been defined yet, and it is used before assigning a value." This is not a fatal error and will not forcefully stop the running of your php code, but there is a potential risk of problems, so it is recommended to modify it. ~~~~

The notice contents are all non-fatal issues that do not affect the use

Use E_ALL & ~ E_NOTICE to turn off the notice display. However, it is recommended to change the code better:)

It’s better to always write the code in a more standardized way, so that there will be fewer problems in the future:)

Turning on this notice display is also helpful for debugging errors~~~~

If your $row is obtained through $row = mysql_fetch_array($result),

And when echo $row['name'], the problem of Notice: Undefined index: appears, then it may be:

1. There is an error in the SQL statement. The value in the name field was not read out.

2. The SQL statement failed to execute and no value was read

3. The SQL is correct and does not fail, but no record that meets the conditions is found, so naturally there is no $row['name']

 4. Others

Notices generally prompt about errors that are not directly related to the execution of the code, but don’t forget that notices sometimes return some redundant error information

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/364675.htmlTechArticleI set error_reporting to E_ALL. When reading data, such as $row['name'], a lot of Notices will appear : Undefined index: Error, what should I do? error_reporting(E_ALL ~ E_NOTICE) Is this...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn