Is it possible to use an exception at the end of a mysql query instead of die()? I’d like to throw an exception and log it instead of killing the script.
Would it be done like:
mysql_query(...) or throw new exception()??
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
This is the way I normally do it. I have my database in a wrapper class, so
$thissimply refers to the wrapper.That packages it all up with a nice error message for me, so I can see the problem query. You could keep it much simpler of course, and do: