To keep this from being a book, I am not going to explain everything in this post.  There will be three files included to make this bad boy work, two supporting and one with the meat.  The first supporting file will contain the database login information:

The second supporting file with contain a custom class with some functions:

Finally we have the meat of it. Do note that in this example I am taking the posted values from a form and using those as my variables: