minor bug on insert

ERROR UNEXPECTED TOKEN D; PHP duplicate entry; insert running twice