To those having this problem. I had two issues producing the error:
Different variable type than specified in mysql. (I had varchar specified in mysql, however in my code I pasted int.)
Type in mysql smaller than required variable size. (I had varchar(4) specified in mysql, however in my code I pasted str of len 5+.)
Hope helps.