Is the ID supposed to be actually generated? I don't think this is going to work as you expect given that id is set to the primary key of the table and afaict `$id` is only ever `''`.