You don't really need to pull templates from a database. It's probably more efficient to include your template files stored on your server into your PHP code. Decrease the overhead of having to establish a database connection.
However, if you really want too.
You could simply create at $template text field within your database (dump your template into this field), give yourself some way to identify it, use a database connection/query to pull it out into a varible and then you can do whatever you like with it.
A more detailed explanation would give you a more detailed response.