Functions and php include

It is extremely sloppy to have to include connection.php in every function that needs to access the database. The database connection should be created outside the functions and passed as an argument into functions which require the database connection.

Also if I were a betting man I would bet that connection.php creates a new database connection each time it is required. In the typical application you will only want to create the connection once and use that same instance throughout the entirety of the request lifecycle.