Turn Off Deprecated type Warning in PHP

sometimes in our PHP website a unwanted warning appears called “Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in D:\xampp\htdocs\opencart\system\database\mysql.php on line 7″. 

this is just a simple warning nothing so serious, so we can easily stop this type of warning from our website. To do so we need to add a Line of code to the top of the .php file like the following:


error_reporting(E_ALL ^ E_DEPRECATED);

Or just add @ in front of mysql_connect () function like this:

@mysql_connect($hostname, $username, $password);

by following these two procedure we can easily remove unwanted Deprecated type errors.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s