Laird_Martin Posted September 5, 2015 Share Posted September 5, 2015 I'm a newb, getting this fatal error when i push a submit button (I've replaced my site name with [root]): Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 2053 ' in /home/[root]/public_html/includes/class_db_handle.php:140 Stack trace: #0 /home/[root]/public_html/includes/class_db_handle.php(140): PDOStatement->fetch(4) #1 /home/[root]/public_html/includes/functions_global.php(178): db_handle->result() #2 /home/[root]/public_html/feedback.php(88): global_class->filter('Great job') #3 {main} thrown in /home/[root]/public_html/includes/class_db_handle.php on line 140 I've attached the 3 files referenced. I'm really new to this so it may be something really simple but I don't see it. i'd appreciate any help I can get. class_db_handle.php feedback.php functions_global.php Quote Link to comment Share on other sites More sharing options...
Laird_Martin Posted September 5, 2015 Author Share Posted September 5, 2015 Oh, forgot to mention, this is from U-Auction script. Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted September 6, 2015 Share Posted September 6, 2015 the error ultimately means that the SELECT query on line 176 in functions_global.php failed due to an error of some kind and there is no result set to fetch anything from. the error handling logic in this code is nonsense. it doesn't handle anything. if there is a database error, you would output a user message alerting the user that the page isn't working at all, and when developing/debugging, you would display the actual error information and on a live server you would log the actual error information. you would also prevent the remainder of the code that's depended on the database working, from running so that the code doesn't throw more errors. the error you are seeing is a follow-on error because the code didn't prevent the fetch method from trying to run after a query error occurred. the error you got isn't where the actual problem is at. i would change the class_db_handle.php error_handler() method to use trigger_error() to display/log the actual error information and then die() with a final user error message that the 'page isn't working at this time'. trigger_error() uses php's error_reporting/display_errors/log_errors settings. error_reporting should ALWAYS be set to E_ALL and when developing/debugging code, display_errors should be ON and on a live server, display_errors should be OFF and log_errors should be ON. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.