[PHP-DB] Duplicate record

2005-07-30 Thread Hallvard
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,

RE: [PHP-DB] Duplicate record

2005-07-30 Thread Martin B. Nielsen
Would'nt the simplest just setting one of the rows as UNIQUE? Or you can add one query that checks if one of the values already exists in the database. Best regards, Martin -Original Message- From: Hallvard [mailto:[EMAIL PROTECTED] Sent: 30. juli 2005 12:17 To: php-db@lists.php.net

Re: [PHP-DB] Duplicate record

2005-07-30 Thread balwant singh
in my opinion you can do the following: 1) once the user submitted the form, redirect to a new page OR 2) may have a unique column in database to avoid duplication like userid etc. With Best Wishes Balwant Singh INDO ASIAN FUSEGEAR LTD. A-39, HOSIERY COMPLEX PHASE

Re: [PHP-DB] Duplicate record

2005-07-30 Thread Miles Thompson
Do a seek 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

Re: [PHP-DB] Duplicate record

2005-07-30 Thread Bastien Koert
after entering the data, send the user to another (confirmation) page...then you avoid the possiblity of duplicates Bastien From: Miles Thompson [EMAIL PROTECTED] To: Hallvard [EMAIL PROTECTED], php-db@lists.php.net Subject: Re: [PHP-DB] Duplicate record Date: Sat, 30 Jul 2005 10:54:16 -0300

Re: [PHP-DB] Duplicate record

2005-07-30 Thread Alexander Veremyev
You could use next simple rules to avoid this problem: 1. Never change anything in your storage (database) by GET HTTP request method. 2. Never prepare any Web page by POST method. 3. After Form is processed (with a POST method) use HTTP redirect to corresponding GET page which should

Re: [PHP-DB] Duplicate record

2005-07-30 Thread Ryan Grange
Alexander Veremyev wrote: You could use next simple rules to avoid this problem: 1. Never change anything in your storage (database) by GET HTTP request method. 2. Never prepare any Web page by POST method. 3. After Form is processed (with a POST method) use HTTP redirect to corresponding