Re: Duplicate records
| From: | Tyler Longren | Date: | Fri, 06 Jun 2003 19:46:29 +0000 |
| Subject: | Re: Duplicate records | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-150538@lists.php.net to get a copy of this message | ||
why not just make the 'id' field in the table auto_increment?
tyler
----- Original Message -----
From: "Steve Marquez" <smarquez@marquez-design.com>
To: "MySQL List" <mysql@lists.mysql.com>
Cc: "PHP eMail List" <php-general@lists.php.net>
Sent: Friday, June 06, 2003 2:40 PM
Subject: [PHP] Duplicate records
> Hello.
>
> 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.
>
> Here is the code I am using:
>
> <?php
>
> $insert_data = "INSERT into articles
>
> Values ( '<a href=\"upload_form.php?id_num=$id_num\">edit</a>',
> '<a
> href=\"delete.php?id_num=$id_num\">delete</a>', '$id_num',
> '$title',
> '$author', '$article_contents', '$start_date', ''
> );";
>
> $response = mysql_query( $insert_data, $dbh );
>
>
> $get_table_data = "SELECT * FROM ccfs";
> $response = mysql_query( $get_table_data, $dbh );
>
> ?>
>
> Can anyone help me? Hope this makes sense.
>
> Thanks!
>
> Steve Marquez
> Marquez Design
> smarquez@marquez-design.com
>
> www.marquez-design.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>