In this quick start guide I'm going to be real brief, it's more of a "examples of PDO code". I will base my queries on MySQL commands since that is most popular, but with the correct drivers installed PDO can connect to most anything.

Let's set a couple attributes, mainly when the data is returned I want the information reachable by name rather than index numbers. Such as accessing data via $row['column name']; versus $row[0] where 0 is the column index number.

Working on a project that involves sending emails. I've been using PHPMailer for many years now, never let me down, is very easy to configure and setup for various different clients and settings.

This new project requires silent errors. We don't want the error messages ever appearing to the end-user, but we do want all errors logged. The issue with PHPMailer is that it ECHO's the error messages directly to the screen rather than passing it back to me. I prefer not to use the ob_* functions so I've managed to nail down what changes are required.

Once you are signed in, on the top right corner "My Account / Console" dropdown, select Security Credentials. OR from "My Account" page, on the left sidebar, select Security Credentials. Go to the Access Credentials heading and you may have to create a new key if one is not already listed.

Copy the Access Record ID and the Secret Access Key, you will need both in a short minute.

/**
* 15 indicates the number of rounds the password will go through hashing
* the higher the number, the better. I use 15 on many applications, it gives
* a 1-2 second delay at login.
**/
$bcrypt = new Bcrypt(15);

Creating a new password, store $hash value in your database

/**
* Hashing a new password.
*
* From here, all you need to do is store string in $hash in your database
**/
$hash = $bcrypt->hash($_POST['new_password']);

Logging a user in:

/**
* Logging in / verifying what was submitted matches.
*
* Must pass the direct password, it does not need to be hashed in order to be verified.
* You will need to query for the users password first, then verify it as such:
**/
if ( $bcrypt->verify($_POST['password'], $databasePasswordValue) ) {
echo 'Password verification correct, logging in';
} else {
echo 'Password verification failed';
}

The class itself, required on any page that you plan on using bcrypt with: