#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Posts
    4
    Rep Power
    0
    How can catch a message from MySQL if a unique constraint is violated?

    When i do an insert from a php-form to MySQL, which violates a unique constraint, i don't get an error message, just the data is not inserted.

    thnx
  2. #2
  3. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,643
    Rep Power
    4492
    Print out mysql_error() after your INSERT command. The error is being generated. See what the error looks like, then you can create some kind of IF statement looking for keywords relating to unique error.

    ---John Holmes...

    ------------------
    *************************************************************
    * The manual can probably answer 90% of your questions...
    *
    * PHP Manual. www.php.net/manual
    * MySQL Manual: www.mysql.com/documentation/mysql/bychapter
    *************************************************************

Similar Threads

  1. unique constraint problem...
    By darkflash in forum PostgreSQL Help
    Replies: 1
    Last Post: January 30th, 2004, 10:30 AM
  2. Replies: 7
    Last Post: January 4th, 2004, 09:52 PM
  3. Upgrade from access to mysql
    By karib1 in forum ASP Programming
    Replies: 7
    Last Post: December 16th, 2003, 12:35 PM
  4. Replies: 1
    Last Post: December 16th, 2003, 05:47 AM

IMN logo majestic logo threadwatch logo seochat tools logo