Solution :
I have read your question. It seems you have just started learning PHP.
I can explain this in simple English, this error message simply means: "I am unable to know the address of your server."
Now in technical words the error message means a hostname which you are trying to connect is not having any public nameserver record.
A database server can only be accessed by very few specific servers, it is because of the security feature just to prevent a whole world from accessing it. So everyone simply can not try to access or hack it
A host is the server which is allowed to connect to your database server which might most probably be a server you upload all your html/php/.. files to.
This error is simply caused by the network related stuff and it is not caused by your programming mistakes.
I hope the way I explained to you must so now it must be very helpful to you in resolving it.