views:

1215

answers:

4

hello

i have a php code, when i run it, a warning appears in the page

how can i remove warning messages? and ignore them

+1  A: 

You could suppress the warning using error_reporting but the much better way is to fix your script.

If you don't know how, edit your question and show us the line in question and the warning that is displayed.

Pekka
solved no need of script i used error_reporting(0);
safaali
Safaali, you ought to fix the problems, not ignore then.
Jonathan Sampson
Safaali, seeing as you have a certain interest in PHP, do yourself a favour and look into fixing that script.
Pekka
A: 

Try with

 error_reporting(E_ALL);
 ini_set("display_errors", 1); 
metrobalderas
Doesn't that do the exact opposite of removing warning messages?
Tatu Ulmanen
+3  A: 

You really should fix whatever's causing the warning, but you can control visibility of errors with error_reporting. To skip warning messages, you could use something like:

error_reporting(E_ERROR | E_PARSE);
Tatu Ulmanen
+2  A: 

You can also try to put a @ infront of your function.

... @yourFunctionHere(); ...
PetPaulsen
This just hides the error, it's still happening. Errors make PHP slow down so it's best to fix the error if at all possible. Using @ even slows down the code when there is not an error. http://vega.rd.no/articles/php-performance-error-suppression
dprevite