sweet! thats what i wanted. thank you! > > On 7/27/05, Bastien Koert <bastien_k@xxxxxxxxxxx> wrote: > > <? > > ... > > $result = mysql_query($query); > > if (mysql_errno($result) == 1062) > > { > > echo "Already present in database"; > > } > > > > ?> > > > > Bastien > > > > >From: JM <frawst1@xxxxxxxxx> > > >Reply-To: JM <frawst1@xxxxxxxxx> > > >To: "php-db@xxxxxxxxxxxxx" <php-db@xxxxxxxxxxxxx> > > >Subject: Trapping a mySQL error > > >Date: Wed, 27 Jul 2005 17:13:09 -0700 > > > > > >Hi all, > > >I have a table with the record_id as the unique primary key and > > >another column (the record_name) as unique as well. This is working > > >how I want it to. I want unique record_names. > > > > > >When the user tries to add a record with an existing record_name the > > >sql statement execution fails: error 1062. How could I trap this error > > >and display a custom message to handle the situation better? Thanks in > > >advance. > > > > > >John > > > > > >-- > > >PHP Database Mailing List (http://www.php.net/) > > >To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > -- > ------------------------------------------------------------------------------- > Charles Morris > cmorris@xxxxxxxxxx > > CS Systems Group Old Dominion University > http://www.cs.odu.edu/~cmorris > http://www.cs.odu.edu/cspage/systemstaff.html > ------------------------------------------------------------------------------ > "Caution! Under no circumstances confuse the mesh with the interleave > operator, except under confusing circumstances!" -- the INTERCAL manual > They that give up essential liberty to obtain > a little temporary safety deserve neither > liberty nor safety. -- Benjamin Franklin, 1759 > The only secure computer is one that's unplugged, locked in a > safe, and buried 20 feet under the ground in a secret location... > and i'm not even too sure about that one"--Dennis Huges, FBI. > -- John Martinez http://www.funkyfreshdesigns.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php