You are here: Re: Error checking for unique value in database table? « PHP Programming Language « IT news, forums, messages
Re: Error checking for unique value in database table?

Posted by Jerry Stuckle on 05/24/07 04:22

Phil Latio wrote:
> "Ravi" <Ravindrayepuri@gmail.com> wrote in message
> news:1179927719.748113.179470@m36g2000hse.googlegroups.com...
>> use Mysql_error() function to get the error value or mysql_errorno()
>> function to get the error no
>
> This thing that confuses me is that it has 2 unique fields. Can these
> functions identify which field has thrown the error?
>
> Cheers
>
> Phil
>
>

Phil,

Proper database normalization means you will not have two unique fields
defining the same row.

With that said - there are a lot of reasons why you might have that
(i.e. userid and email address must be unique).

If it does fail, then do your SELECT and see which one caused the error.
If you get nothing back, then the row was deleted between the time you
tried the insert and ran the select - so you should be able to retry it.
Just limit the number of retries so you don't get into a race
condition between two scripts.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация