timmy2 Posted August 10, 2007 Share Posted August 10, 2007 A php book I was reading said I could make is so that all the php error's get sent to my email. I dont have the book anymore but was wondering how to do it? Link to comment https://forums.phpfreaks.com/topic/64334-solved-outputing-errors-to-email/ Share on other sites More sharing options...
Fadion Posted August 10, 2007 Share Posted August 10, 2007 Dont think is smth very easy or automated. Even so, u should do some error handling and for those functions which can cause errors (like: mysql_query, fopen etc) u could send an email. One idea is to make a function ex. sendMail($msg) where u define the headers and all that staff for the mail, and use: $query = "SELECT * FROM table"; $results = @mysql_query($query) or sendMail("Query $query cause an error"); Thats what i can think about. Link to comment https://forums.phpfreaks.com/topic/64334-solved-outputing-errors-to-email/#findComment-320786 Share on other sites More sharing options...
teng84 Posted August 10, 2007 Share Posted August 10, 2007 @GuiltyGear $results = @mysql_query($query) or sendMail("Query $query cause an error"); [\code] why do you have ("@") i always see this in this forum i hate it im scratching my head putting this kind of thing simply mean that the code is not perfect or you anticipate for the wrong output Link to comment https://forums.phpfreaks.com/topic/64334-solved-outputing-errors-to-email/#findComment-320789 Share on other sites More sharing options...
Fadion Posted August 10, 2007 Share Posted August 10, 2007 Because with error reporting 'e_all', without an '@' it will print warnings and errors. I always place '@' at my code after ive tested and debugged it, just as a security measure, as i dont want others to see whats happening in queries and such. Link to comment https://forums.phpfreaks.com/topic/64334-solved-outputing-errors-to-email/#findComment-320794 Share on other sites More sharing options...
teng84 Posted August 10, 2007 Share Posted August 10, 2007 i have done my codes without that @ of yours and its not getting error if you need security then test it before running it do some validation Link to comment https://forums.phpfreaks.com/topic/64334-solved-outputing-errors-to-email/#findComment-320796 Share on other sites More sharing options...
Fadion Posted August 10, 2007 Share Posted August 10, 2007 As i said i always use '@' as a security measure, after ive tested my code. Plus someone can inject code in your query string and without @ it will bring up the real error message, showing up important data. Maybe u can protect your code well, but think it twice, those '@' arent created to use them for fun. Link to comment https://forums.phpfreaks.com/topic/64334-solved-outputing-errors-to-email/#findComment-320823 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.