title: How to generate blog posts from database with PHP?
body: <p>How do I make a form, like Wordpress and Drupal, that adds data to the mySQL database?</p>
  
  <p>Then, and this is more important, how do I go about making a PHP file (say, index.php) that loads the appropriate data from the database, formats that data into a post, and displays it without me having to create a file for each post. </p>
  
  <p>I have tried two different ways so far: a list of dummy posts and a mySQL database, but I don't want a list of duplicated .php files in case I want to change the site's format later and I don't know how to apply a template to the raw data in the database and display that. I know how to inject the data in a PHP file but I don't want to have to do that for every post.</p>
  
  <p>It seems like a lot of work but I don't even know how to go about trying it. </p>
  
  <p>EDIT: Sorry, I suppose I wasn't very clear. I know how to work with PHP and mySQL, and I know how to populate a webpage with data from a table etc. What I'm trying to do however is create a template along with some code that will take rows out of a table, apply a format to that data, and display it on the webpage AND do that for multiple posts in order (so that I end up with a page with many posts on it). Of course I could make each individual post, put it in a file, write some PHP to extract data from the db and put it in the right places in the html, apply some css and voila I've got a blog post that I can now <code>include</code> in the index.php. But I don't really want to end up with a hundreds files, each of which I have customized by hand. I want to automate this process, and I'm wondering how.</p>