Display Errors in Browser Window

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
macbeth
Forum Newbie
Posts: 9
Joined: Fri Apr 24, 2009 9:27 am

Display Errors in Browser Window

Post 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.
User avatar
jazz090
Forum Contributor
Posts: 176
Joined: Sun Apr 12, 2009 3:29 pm
Location: England

Re: Display Errors in Browser Window

Post 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
Post Reply