RE: [PHP] Duplicate records
| From: | John W. Holmes | Date: | Fri, 06 Jun 2003 21:18:16 +0000 |
| Subject: | RE: [PHP] Duplicate records | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-150549@lists.php.net to get a copy of this message | ||
> I am adding a record to a MySQL Database using PHP. I have the records
> listed by the field: $id_num.
>
> I want the DB to be updated only with new id numbers, and return an
error
> if
> there is a duplicate number already in the DB.
So make the "id_num" column UNIQUE or a PRIMARY KEY. Then you will get
an error if you insert a duplicate value. Find the error by using
mysql_error().
---John W. Holmes...
Amazon Wishlist: http://www.amazon.com/o/registry/3BEXC84AB3A5E
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/