0

Recently I've been getting the error:

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead

We all know what causes the error, however I need to launch an application tomorrow and simply dont have time to change all my queries. I'll only be able to get to it during the week. In the mean time I would like to know what would be the best way to hide this specific notice without having to use the @ sign or turning error notices of

Marilee
  • 1,598
  • 4
  • 22
  • 52

1 Answers1

2

You can disable error reporting using this code:

<?php
error_reporting(E_ALL ^ E_DEPRECATED);

More information at http://php.net/manual/en/function.error-reporting.php.

However, please use MySQLi in future as MySQLi supports prepared statements which a safer way of sending data to MySQL and protecting you from SQL injection.

Panda
  • 6,955
  • 6
  • 40
  • 55
  • will accept as soon as 10-mins pass – Marilee Mar 05 '16 at 02:14
  • Really? Instead of upgrading to something actual you propose to *hide* the deprecated errors? – Kevin Kopf Mar 05 '16 at 02:23
  • @Nordenheim It's stated that *We all know what causes the error, however I need to launch an application tomorrow and simply dont have time to change all my queries. I'll only be able to get to it during the week.*. So, it's a temporary 'fix'. – Panda Mar 05 '16 at 02:27
  • @luweiqi yeah okay valid point, I didn't really read the rest of the text after the first line – Kevin Kopf Mar 05 '16 at 02:31