Retrieving MySQL exceptions

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
stagtechnologies
Forum Newbie
Posts: 2
Joined: Tue Dec 02, 2008 12:39 pm

Retrieving MySQL exceptions

Post by stagtechnologies »

Hi

I want to display the actual exceptions that occurs on the database side rather than showing my custom messages in PHP using throw clause. How can i do this?
eg: on inserting a record in the database, i am getting a unique constraint violation exception but i dont know how to display it in php.

Thanks and regards
Admin
http://www.stagtechnologies.com
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: Retrieving MySQL exceptions

Post by jaoudestudios »

Do a check first to see if the entry already exists, if so then you have your flag, if not you can do the insert :)
stagtechnologies
Forum Newbie
Posts: 2
Joined: Tue Dec 02, 2008 12:39 pm

Re: Retrieving MySQL exceptions

Post by stagtechnologies »

thanks
but i dont want to do that on the application side
i have got integrity constraints in place in the database
they are giving me exceptions
i just want to print those on the UI using php
can i do that
Post Reply