I have a **MySQL** database and I am working with **Core PHP**.

What is the best practice in terms of accessing the database? Should I 

1. create functions in MySQL and access them in my PHP-code **OR**
2. write inline queries from code directly?

Let me know if you need any additional info