Acquiring employee information I am curious to know if there is a faster, better, and more efficient way to accomplish this program that acquires employee information:

    &lt;?php
session_start();
//require 'functions.php';
//require 'DB.php';
$employeeID = $_SESSION['employeeID'];
$clockIn = $_GET['clockIn'];
$clockOut = $_GET['clockOut'];
$timeToday = date("g:i a");
$dateToday = date("m/d/y");
$jobDescription = $_GET['jobDesc'];
$equipType = $_GET['equipTypeRan'];
$unitNumber = $_GET['unitNumber'];
$unitHours = $_GET['unitHours'];
if (isset($clockIn)) {

    echo "You clocked in at: " . $timeToday . " on " . $dateToday;

    try {
    $conn = new PDO('mysql:host=localhost;dbname=timecard', 'username', 'password');
    $conn-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $stmt = $conn-&gt;prepare('INSERT INTO timeRecords (employeeID, date, timeIn) VALUES (:employeeID, :dateToday, :timeIn)');

    $stmt-&gt;execute(array(':employeeID' =&gt; $_SESSION['employeeID'], ':dateToday' =&gt; $dateToday, ':timeIn' =&gt; $timeToday));

    } catch(PDOException $e){
        echo'ERROR: ' . $e-&gt;getMessage();
    }
    $conn = null;


} else if (isset($clockOut)) {

        try {
    $conn = new PDO('mysql:host=localhost;dbname=timecard', 'username', 'password');
    $conn-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $stmt = $conn-&gt;prepare('UPDATE `timeRecords` SET `timeOut`= :timeOut WHERE `date`= :dateToday AND `employeeID`= :employeeID');

    $stmt-&gt;execute(array(':employeeID' =&gt; $_SESSION['employeeID'],':dateToday' =&gt; $dateToday, ':timeOut' =&gt; $timeToday));

    $stmt = $conn-&gt;prepare('SELECT `timeIn` FROM `timeRecords` WHERE `date`= :dateToday AND `employeeID` = :employeeID');
    $stmt-&gt;execute(array(':employeeID' =&gt; $_SESSION['employeeID'], ':dateToday' =&gt; $dateToday));
    $stmt-&gt;setFetchMode(PDO::FETCH_BOTH);
    $results = $stmt-&gt;fetch();
    $timeInDB = $results[0];

    } catch(PDOException $e){
        echo'ERROR: ' . $e-&gt;getMessage();
    }

    $time_one = new DateTime($timeInDB);
    $time_two = new DateTime($timeToday);
    $difference = $time_one-&gt;diff($time_two);

    echo "You clocked in at: " . $timeInDB . "&lt;br&gt;";
    echo "You clocked out at: " . $timeToday . "&lt;br&gt;";

    echo $difference-&gt;format('Total working time %h hours %i minutes');

}else {

try{
    $conn = new PDO('mysql:host=localhost;dbname=timecard', 'username', 'password');
    $conn-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $stmt = $conn-&gt;prepare("SELECT COUNT(*) FROM timeRecords WHERE `timeOut` IS NULL AND `employeeID`= :employeeID AND `date`= :dateToday");

    $stmt-&gt;execute(array(':employeeID' =&gt; $employeeID, ':dateToday' =&gt; $dateToday));
    } catch(PDOException $e){
        echo'ERROR: ' . $e-&gt;getMessage();
    }

if($stmt-&gt;fetchColumn() &gt; 0){

    try{
    $conn = new PDO('mysql:host=localhost;dbname=timecard', 'username', 'password');
    $conn-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $stmt = $conn-&gt;prepare('UPDATE `timeRecords` SET `jobDescription`= :jobDescription, `equipType`= :equipType, `unitNumber`= :unitNumber, `unitHours`= :unitHours, 
                            `timeOut`= :timeOut WHERE `employeeID`= :employeeID AND `date`= :dateToday AND `timeOut` IS NULL');

    $stmt-&gt;execute(array(':employeeID' =&gt; $employeeID, ':timeOut' =&gt; $timeToday, ':dateToday' =&gt; $dateToday, ':jobDescription' =&gt; $jobDescription,
                         ':equipType' =&gt; $equipType, ':unitNumber' =&gt; $unitNumber, ':unitHours' =&gt; $unitHours));

    $stmt = $conn-&gt;prepare('INSERT INTO timeRecords (employeeID, date, timeIn) VALUES (:employeeID, :dateToday, :timeIn)');
    $stmt -&gt;execute(array(':employeeID' =&gt; $employeeID, ':dateToday'=&gt; $dateToday, ':timeIn' =&gt; $timeToday));
    } catch(PDOException $e){
        echo'ERROR: ' . $e-&gt;getMessage();
    }

    echo "There was an update";
} else {
    echo "There was no Match";
}

    require 'summary.php';

}

?&gt;
Defining the same connection multiple times can be avoided, and also, putting everything in try/catch serves no purpose if the only thing you do in the catch is displaying the message which would be displayed anyway with the error reporting mode you set on the $conn

I also find that naming PDOStatements can help a bit for readability, instead of always using $stmt. Here it all happens in few lines, but sometimes, using a prepared statement far away in the code can be easier if they have significant names.

Doing this, I noticed your clockIn PDOStatement is done twice. Since the if prevents it from happening twice, it's OK, but perhaps you could find some use in preparing your PDOStatements outside of loops, then executing them in the loops.

&lt;?php

session_start();
//require 'functions.php';
//require 'DB.php';
$employeeID = $_SESSION['employeeID'];
$clockIn = $_GET['clockIn'];
$clockOut = $_GET['clockOut'];
$timeToday = date("g:i a");
$dateToday = date("m/d/y");
$jobDescription = $_GET['jobDesc'];
$equipType = $_GET['equipTypeRan'];
$unitNumber = $_GET['unitNumber'];
$unitHours = $_GET['unitHours'];

$conn = new PDO('mysql:host=localhost;dbname=timecard', 'username', 'password');
$conn-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

$putClockIn = $conn-&gt;prepare('INSERT INTO timeRecords (employeeID, date, timeIn) VALUES (:employeeID, :dateToday, :timeIn)');

if (isset($clockIn)) {
    echo "You clocked in at: " . $timeToday . " on " . $dateToday;
    $putClockIn-&gt;execute(array(
        ':employeeID' =&gt; $_SESSION['employeeID'],
        ':dateToday' =&gt; $dateToday,
        ':timeIn' =&gt; $timeToday
    ));
    $conn = null;
} else {
    if (isset($clockOut)) {
        $putClockOut = $conn-&gt;prepare('UPDATE `timeRecords` SET `timeOut`= :timeOut WHERE `date`= :dateToday AND `employeeID`= :employeeID');
        $putClockOut-&gt;execute(array(
            ':employeeID' =&gt; $_SESSION['employeeID'],
            ':dateToday' =&gt; $dateToday,
            ':timeOut' =&gt; $timeToday
        ));
        $getTimeIn = $conn-&gt;prepare('SELECT `timeIn` FROM `timeRecords` WHERE `date`= :dateToday AND `employeeID` = :employeeID');
        $getTimeIn-&gt;execute(array(':employeeID' =&gt; $_SESSION['employeeID'], ':dateToday' =&gt; $dateToday));
        //$getTimeIn-&gt;setFetchMode(PDO::FETCH_BOTH);
        $results = $getTimeIn-&gt;fetch(PDO::FETCH_BOTH); // no need to set a mode for stmt if you ain't using it anywhere else, pass it directly in fetch()
        $timeInDB = $results[0];
        $time_one = new DateTime($timeInDB);
        $time_two = new DateTime($timeToday);
        $difference = $time_one-&gt;diff($time_two);
        echo "You clocked in at: " . $timeInDB . "&lt;br&gt;";
        echo "You clocked out at: " . $timeToday . "&lt;br&gt;";
        echo $difference-&gt;format('Total working time %h hours %i minutes');
    } else {
        $getCurrentSessions = $conn-&gt;prepare("SELECT COUNT(*) FROM timeRecords WHERE `timeOut` IS NULL AND `employeeID`= :employeeID AND `date`= :dateToday");
        $getCurrentSessions-&gt;execute(array(':employeeID' =&gt; $employeeID, ':dateToday' =&gt; $dateToday));
        if ($getCurrentSessions-&gt;fetchColumn() &gt; 0) {
            $closeSession = $conn-&gt;prepare('UPDATE `timeRecords` SET `jobDescription`= :jobDescription, `equipType`= :equipType, `unitNumber`= :unitNumber, `unitHours`= :unitHours, 
                                `timeOut`= :timeOut WHERE `employeeID`= :employeeID AND `date`= :dateToday AND `timeOut` IS NULL');
            $closeSession-&gt;execute(array(
                ':employeeID' =&gt; $employeeID,
                ':timeOut' =&gt; $timeToday,
                ':dateToday' =&gt; $dateToday,
                ':jobDescription' =&gt; $jobDescription,
                ':equipType' =&gt; $equipType,
                ':unitNumber' =&gt; $unitNumber,
                ':unitHours' =&gt; $unitHours
            ));
            $putClockIn-&gt;execute(array(
                ':employeeID' =&gt; $employeeID,
                ':dateToday' =&gt; $dateToday,
                ':timeIn' =&gt; $timeToday
            ));
            echo "There was an update";
        } else {
            echo "There was no Match";
        }
    }
}

require 'summary.php';