Page 1 of 1

Display Errors in Browser Window

Posted: Thu May 07, 2009 11:03 am
by macbeth
Can somebody tell me how to display errors in my browser window. I am just beginning to use php and I would like to see exactly where my code breaks so it is easier for me to troubleshoot.

I am told that in the php.ini file that the "Error Reporting" is set to ON and the "Display Error" is set to ON. But I am not getting detailed errors. Note: I don't have access to the php.ini file.

What I get is a generic:

Server Error: 500 - Internal server error. There is a problem with the resource you are looking for, and it cannot be displayed.

When in fact I am sure it found and connected to the server. I know this because I take out all of the othe code and it works.

I'm sorry if I am not explaining myself well. Like I said this is all new to me and I am trying to teach myself. Any help would be greatly appreciated.

Re: Display Errors in Browser Window

Posted: Thu May 07, 2009 3:54 pm
by jazz090
if you want to see where your code is breaking use the die() command which can be used with functions as well as seperatly:

Code: Select all

mysql_query($query) or die(mysql_error());
or

Code: Select all

mysql_query($query) or die("could not perform query");
if you use it without a method just by itself, it will always break your code regardless of any error