Show DevBest [PHP] Get rid of errors

Status
Not open for further replies.

Micki

Active Member
Sep 2, 2011
105
22
It basically get's rid off all errors on your page.
Make sure you put them in PHP tags at the top of your page

PHP:
error_reporting (E_ALL ^ E_NOTICE); // Gets rid off all errors

Hope I helped:)
 

brsy

nah mang
May 12, 2011
1,530
272
It basically get's rid off all errors on your page.
Make sure you put them in PHP tags at the top of your page

PHP:
error_reporting (E_ALL ^ E_NOTICE); // Gets rid off all errors

Hope I helped:)
Or, you can simply just allow errors, and then learn to fix them. That way your programs will work as they should, and you will get better.
 

GarettM

Posting Freak
Aug 5, 2010
833
136
It basically get's rid off all errors on your page.
Make sure you put them in PHP tags at the top of your page

PHP:
error_reporting (E_ALL ^ E_NOTICE); // Gets rid off all errors

Hope I helped:)
Uhm
PHP:
error_reporting (0); // Gets rid off ALL errors
;] Turns error_reporting off
 

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,637
2,389
@garettjoey's method is better, however, I prefer to have the errors enabled and display all of them so if an error does occur then I will know what line it is on and what is wrong with it.

In the past I've often disabled error reporting and something never worked and I had forgotten that I had disabled error reporting which made me very angry because I didn't know what was wrong with my project.
 

GarettM

Posting Freak
Aug 5, 2010
833
136
@garettjoey's method is better, however, I prefer to have the errors enabled and display all of them so if an error does occur then I will know what line it is on and what is wrong with it.

In the past I've often disabled error reporting and something never worked and I had forgotten that I had disabled error reporting which made me very angry because I didn't know what was wrong with my project.
M0nsta is right or DuckilingX​
Error reporting was made to help the developer figure out what was wrong in the code. In all if you don't want any errors, just fix it to a point were it doesn't need error reporting..​


example ( ik code is shit i just wook up! )​

PHP:
<?php 
switch($_PAGE['id'])
{
 case 'index':
  print '';
  break;
case 'home':
  print '';
  break;
}
You will Get the PHP error undefined $_PAGE i believe
i believe to fix this with out error_reporting
PHP:
<?php
if(!isset($_GET['page'])) ? $_GET['page'] : 'index'; 
 
switch($_PAGE['id'])
{
 case 'index':
  print '';
  break;
case 'home':
  print '';
  break;
}
?>

P.S. if this makes no sence just ignore it ;P imma magical sleepy poster@!!
 

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,637
2,389
M0nsta is right or DuckilingX​
Error reporting was made to help the developer figure out what was wrong in the code. In all if you don't want any errors, just fix it to a point were it doesn't need error reporting..​

example ( ik code is shit i just wook up! )​

PHP:
<?php
switch($_PAGE['id'])
{
case 'index':
  print '';
  break;
case 'home':
  print '';
  break;
}
You will Get the PHP error undefined $_PAGE i believe
i believe to fix this with out error_reporting
PHP:
<?php
if(!isset($_GET['page'])) ? $_GET['page'] : 'index';
 
switch($_PAGE['id'])
{
case 'index':
  print '';
  break;
case 'home':
  print '';
  break;
}
?>

P.S. if this makes no sence just ignore it ;P imma magical sleepy poster@!!
Sorry to be an asshole and possibly spam the thread, but would you really get an error for $_PAGE? Wouldn't it just recognise it as an undefined array and not pass off an error, just run through the code anyway?
 

GarettM

Posting Freak
Aug 5, 2010
833
136
Nope php would give you <b>message</b> important or undefined there if there was no error_reporting tag i think actually you cant do _GET with out error reporting unless u use if statements
 

brsy

nah mang
May 12, 2011
1,530
272
Nope php would give you <b>message</b> important or undefined there if there was no error_reporting tag i think actually you cant do _GET with out error reporting unless u use if statements
is right. This would cause an error:
PHP:
echo $_POST['param'];
 
Status
Not open for further replies.

Users who are viewing this thread

Top