1

I want to hide all mysql error messages without using mysql_error(). Are there any solutions?

Simon
  • 22,637
  • 36
  • 92
  • 121

3 Answers3

9

First line of code before any function in your php script

error_reporting(0);
mjv
  • 73,152
  • 14
  • 113
  • 156
markcial
  • 9,041
  • 4
  • 31
  • 41
  • 1
    read documentation to get more info http://www.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting – markcial Mar 18 '10 at 16:27
9

Put @ in front of your mysql_query call (@mysql_query('some query');) to suppress the error messages.

Marek Karbarz
  • 28,956
  • 6
  • 53
  • 73
  • 5
    In this way you get rid of your error messages, but it won't solve problem with your query. Suppressing error messages isn't the right way to do it. You should fix your queries. – Mikk Mar 18 '10 at 17:50
0

Yes you can add @ before all mysql queries.

example:

$result = @mysql_db_query ("database","SELECT * FROM agents WHERE ID = '$id'");

Jason Roman
  • 8,146
  • 10
  • 35
  • 40
khaldonno
  • 449
  • 4
  • 2