How to allow multiple thumbnail upload for Posts?

Have you considered using the ACF plugin? ACF has a very convenient field type – gallery. I think it would match what you want a 100% without the need to poke around the native/custom DB queries. Check it out.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)