How to disable a database error occurred and a PHP error was encountered in codeigniter

Source: Internet
Author: User
ArticleDirectory
    • 2. disable a PHP error was encountered error prompt in codeigniter

The following two error messages are displayed:

A PHP error was encountered

Severity: Notice

Message: Trying to get property of non-Object

Filename: XXXXX

Line number: 67

A database error occurred

Error number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL Server version for the right syntax to use near ''at line 1

Select * From table_example where field =

Filename: XXXXX

Line number: 72

The correct solution is to check for errors and solve bugs. However, some unexpected bugs may leak some information, so it is necessary to disable such errors in the online environment.

However, according to the manual:

Note:By default, codeigniter will display all PHP errors.ProgramAt the end, you may want to change this situation. You will find this function at the top of the index. php file.Error_reporting ()You can use it to set errors. Even if you disable the Error Report, the error record will not stop when an error occurs.

Therefore, modifying PHP. ini cannot achieve the desired effect.

The solution is as follows:

1. Disable codeigniter A database error occurred Error Message

Modify index. phpError_reporting:

 
Case 'production ': error_reporting(0); Break;
2. disable a PHP error was encountered error prompt in codeigniter

Modify database settings in config/database. php:

$ DB ['Default'] ['Db _ debug']=False;

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.