in reply to best method to update mysql records over the web

Mr Scary, Here is how I do it, and I am assuming that you have a database connection.
use strict; use diagnostics; ############################################################ # Using the \$STATEMENT varible makes it easier # for me to prepare it for 'quotes' that are needed # by SQL (MySql) and helps me resolve my variables safely. # ---------------------------------------------------------- my $STATEMENT = "UPDATE SUPPORTDESK.CONTACT_PERSON SET SALUTATION=$S +ALUTATION,FIRST_NAME=$FIRST_NAME,MIDDLE_INITIAL=$MIDDLE_INITIAL,LAST_ +NAME=$LAST_NAME,NOTES=$NOTES WHERE CONTACT_PERSON.CONTACT_PERSON_ID=$ +CONTACT_PERSON_ID"; ############################################################ # Prepare the statement for database execution. This inserts # quotes where needed # ---------------------------------------------------------- # $DBACCESS is the database connection handle '$dbh' my $COMMAND = $DBACCESS->prepare($STATEMENT); #Executed the statment. $COMMAND->execute; ############################################################ # Kill the statement handle so that you can safely # disconnect from the database. # ---------------------------------------------------------- $COMMAND->finish;
Word of caution. I use InnoDB style database tables which autocommit. Autocommitting means once you put information there, it is permanent. No rolling back, and the information is flushed to the disk. If you don't autocommit then the Statement will be more like this... my $STATEMENT = "BEGIN; UPDATE SUPPORTDESK.CONTACT_PERSON  SET   SALUTATION=$SALUTATION,FIRST_NAME=$FIRST_NAME,MIDDLE_INITIAL=$MIDDLE_INITIAL,LAST_NAME=$LAST_NAME,NOTES=$NOTES WHERE CONTACT_PERSON.CONTACT_PERSON_ID=$CONTACT_PERSON_ID; COMMIT"; I hope this helps. Kristofer Hoch