When I run my script give an error at this mysql statement I checked and rechecked to see if something is wrong but I don’t think any way need a new set of eyes to see if something is wrong.
So what error are you actually receiving? We can check the query syntax for errors (of which I can’t see any), but for things like invalid attribute/relation names, that’ll be in the error message.
I’d also suggest you to use interpolation (since you’re using double quotes anyway) instead of concatenation for a more legible query. The following using the heredoc method:
Are you sure all DB field names are as written,e.g. img1, Img2… upper and lower case?
All variables are written as defined, with upper and lower case letters?