PHP Detecting SQL connection settings errors

by 3 replies
4
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.
#programming #connection #detecting #errors #php #settings #sql
  • 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.
    • [1] reply
    • It's nicely documented ... thank you
  • 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.
  • [DELETED]

Next Topics on Trending Feed