Help with functions / PDO statements

Yes, my bad.

Look, there is a code you have to put into functions.php. The code you may find under the section “Code” by the link provided. You have to put all that code into a file and edit constants at the top, providing your actual database credentials.

That’s all!
Assuming you already have functions.php included in all your scripts, you will have instant access to PDO. Thus you will be able to write getCities function the way I showed above - in just two lines, without any extra code to connect to PDO as connection will be stored in the static DB class.