For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > July 2005 > Re: [PHP-DB] Duplicate record









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PHP-DB] Duplicate record
Miles Thompson

2005-07-30, 8:59 am



Do a s on the fields which cannot be duplicated; if there's a
hit reload the page with the appropriate error message, otherwise reload
the page with a success message.

Although I have not worked with AJAX, this would appear to be an excellent
spot to use it. Silently check after focus has left the final field which
must be unique, doing nothing if data is OK, putting up a flag if there was
duplication.

As for a unique ID for each record, i.e. one that autoincrements, that's
almost always a good idea.

Regards - Miles Thompson

At 07:17 AM 7/30/2005, Hallvard wrote:
>I have a page that posts data from a form to a mysql database.
>
>The problem is that if the user hits the reload button on the browser, the
>data will be posted again, resulting in a duplicate record.
>
>How can I avoid that?
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

Bastien Koert

2005-07-30, 4:59 pm

after entering the data, send the user to another (confirmation) page...then
you avoid the possiblity of duplicates

Bastien

>From: Miles Thompson <miles@allnovascotia.com>
>To: "Hallvard" <hallvard@natvik.com>, php-db@lists.php.net
>Subject: Re: [PHP-DB] Duplicate record
>Date: Sat, 30 Jul 2005 10:54:16 -0300
>
>
>
>Do a s on the fields which cannot be duplicated; if there's a hit
>reload the page with the appropriate error message, otherwise reload the
>page with a success message.
>
>Although I have not worked with AJAX, this would appear to be an excellent
>spot to use it. Silently check after focus has left the final field which
>must be unique, doing nothing if data is OK, putting up a flag if there was
>duplication.
>
>As for a unique ID for each record, i.e. one that autoincrements, that's
>almost always a good idea.
>
>Regards - Miles Thompson
>
>At 07:17 AM 7/30/2005, Hallvard wrote:
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com