how to link to the database

Thanks for the great code, i really appreciate it. I was searching for this kind or code for a long time so i found it here.

i made a question in this website:

http://stackoverflow.com/questions/25892579/my-script-can-uploads-the-avatar-profile-image-but-cant-change-the-size-height

but i do not know how to embed it to my code can you please guide me through.

thanks and regards.