move mysql_insert_update_delete to database