"Craig Hoffman" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> What is the best way to avoid data being resubmitted (entered twice) to
> DB (mysql) if the user hits refresh after POSTING data via a form?

You can make it even more easy for inserts by using the SQL command IGNORE.
Just make the column with the unique transaction ID your primary key or (if
you don't use a auto-increment column) make your id column the primary key
and use:

INSERT IGNORE INTO table ...

So the record is only inserted if the primary key doesn't exist yet and just
ignores multiple inserts with the same id. This should work for MySQL - I
don't know if it works for other DBs as well.

I don't see a problem for multiple updates as the data usually won't change
between the refresh.

Regards, Torsten Roehr

> __________________________________
> Craig Hoffman - eClimb Media
>
> v: (847) 644 - 8914
> f: (847) 866 - 1946
> e: [EMAIL PROTECTED]
> w: www.eclimb.net
> _________________________________

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to