INSERT or UPDATE if contents exist
Posted on 2005-04-05
BatAlf has been helping me with a form for displaying conference registration info and updating that info. One of the problems I've come across is that there are input fields generated in which a room number gets written and logged to a db. The problem is this: the idea is that the room number gets written to the database, the page reloads with the room number still displayed in the <iinput field>. If it needs to be changed, it is easy enough to change it there. Initially the room number has a NULL value, so I can't use an UPDATE statement when the form is submitted, and if there is already a room number listed that I want to change, an INSERT statement won't work, but will just write another row to the table.
I've searched both here and on the MySQL site for a solution for this problem, but without success in finding one.
Thanks to any who can suggest how to deal with this problem.