PHP Detecting SQL connection settings errors

3 replies
Hi all,

Would anyone be able to demonstrate how I could detect SQL connection errors on first page load, but before running my scripts?

The idea would then be to hide the regular errors when things do go wrong, as they've already been detected.

Thanks.
#connection #detecting #errors #php #settings #sql
  • Profile picture of the author David Beroff
    I think you're describing the try / catch mechanism that is used with PDO. I actually blogged just the other day about the sites that helped me to learn PDO.
    Signature
    Put MY voice on YOUR video: AwesomeAmericanAudio.com
    {{ DiscussionBoard.errors[8406859].message }}
    • Profile picture of the author darshana84
      Originally Posted by David Beroff View Post

      I think you're describing the try / catch mechanism that is used with PDO. I actually blogged just the other day about the sites that helped me to learn PDO.
      It's nicely documented ... thank you
      {{ DiscussionBoard.errors[8409363].message }}
  • Profile picture of the author SteveJohnson
    Your question is kind of generic - here's generic answer. You test for an error condition after trying to connect to the database. Precisely how you do that depends on what method you're using to communicate with MySQL.
    Signature

    The 2nd Amendment, 1789 - The Original Homeland Security.

    Gun control means never having to say, "I missed you."

    {{ DiscussionBoard.errors[8409337].message }}

Trending Topics