Hello,
A complete Python newbie needs help. :-) I have a simple script that updates the 'note' field in a MySQL database table based on the record's id:
id=raw_input("Record id: ")
update=raw_input("Note: ")
cursor.execute ("UPDATE notes SET note='"+update+"' WHERE id='"+id+"'""")
print "\nRecord has been updated."
The problem with this solution is that the user must enter everything from scratch. What I'd like to do is to allow the user to edit the current contents. For example, if the 'note' field contains the string "Monkey loves banana", the input field would look like this:
Note: Monkey loves banana
and the user can then edit this string. I can easily obtain the contents of the record using the following code:
row = cursor.fetchone ()
contents = row[1]
But how do I add it to the raw_input part?
I hope my question makes sense.
Thank you!
Kind regards,
Dmitri