PHP supports one error control operator: the at sign (@). When prepended to an expression in PHP, any error messages that might be generated by that expression will be ignored.
If the track_errors feature is enabled, any error message generated by the expression will be saved in the global variable $php_errormsg. This variable will be overwritten on each error, so check early if you want to use it.
1 2 <?php 3 /* Intentional SQL error (extra quote): */ 4 $res = @mysql_query( "select name, code from 'namelist" ) or 5 die( "Query failed: error was '$php_errormsg'" ); 6 ?> 7 |
See also error_reporting().