In your database table, you also need the field 'id' (or something similar) to identify which row you are editing. You could probably go into your database using a web-based administration tool such as PHPmyAdmin (or similar) and add this field in there.
Other than that, the script will not function properly (the snippet I posted above).
Hope this helps.
