Jump to content

Fatal Error Help


Laird_Martin

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.