Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8365655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:42:34+00:00 2026-06-09T12:42:34+00:00

I am having a strange situation. When a class instance is passed to a

  • 0

I am having a strange situation.

When a class instance is passed to a method & the class instance has not been set, the server throws a 500 error, instead of catching the error.

This happends during testing 99% of the time, but I want to make sure a user never sees it for that 1%

BTW : I have already checked my .htaccess and apache2 files <= they are correct

What do i need to change in my php.ini file or something similar to avoid a 500 error everytime this happens??

Here is some sample code :

<?php

function querysomething ($connection_to_mysql, $query) {
  try {
    $query = $connection_to_mysql->prepare("SELECT * FROM table WHERE name=?");
    $query->bind_param("s", $name);
    $execute = $query->execute();
    //etc...
    if (!$execute) {
      throw new Exception ("some error");
    }
  } catch (Exception $e) {
    //some error handling
  }
}

?>

If the $connection_to_mysql object is not instantiated, the server throws a 500 error

Do I need to check if the $connection_to_mysql actually exists everytime prior to query?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T12:42:36+00:00Added an answer on June 9, 2026 at 12:42 pm

    Use set_error_handler/set_exception_handler to display a php fatal error-specific page.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having a strange problem with a page set to 100% fluid width which has
I have been having a strange problem using a custom delegate class in ARC.
I'm having a strange situation occuring where I'm able to read and save information
I'm having a strange situation, and I can't figure out the problem. I want
i'm having strange behavior from the for loop in python. The problem is not
I am kinda having a strange requirement. I have a google talk bot &
I'm having a strange situation where the injection of some Stateless EJBs into a
i'm having a very strange situation. Every time I try to compile my arm
Having a strange issue with some C# code - the Getter method for a
I am having a kinda strange problem. Here is the situation. I have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.