error_reporting(0) is used to hide error message..!!
i want to hide server message but i what to show other error msg in place of server message..!!
that can be possible..?
Thanks,,!!
error_reporting(0) is used to hide error message..!!
i want to hide server message but i what to show other error msg in place of server message..!!
that can be possible..?
Thanks,,!!
hey,
It is possible, but is a little harder thank you are thinking.
For example.
try {
mysql_connect(blah);
} catch (Exception e){
echo 'Failed to connect to sql.';
}
For system functions.
Or you can do something like this,
after hiding all error messages with error reporting.
function displayError($error){
echo 'Javascript to display error as popup or whatnot';
die(); //kill the page so it does not load anymore
}
mysql_connect($blag) or displayError('No connection to SQL server');
A bit of reading:
http://php.net/manual/en/language.exceptions.php
Hope this helps,
Nick.
error_reporting(0) is used to hide error message..!!
i want to hide server message but i what to show other error msg in place of server message..!!that can be possible..?
Thanks,,!!
server messages , you mean http errors or the php errors thrown by the server.
Adding something like this in your .htaccess will show your custom error page on the http errors(in below example 404 error) -
ErrorDocument 403 /errordocs/error403.htm
ErrorDocument 404 /errordocs/error404.htm
ErrorDocument 500 /errordocs/error500.htm
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.