<?php
$output='xx';
  try {

		// My database credentials are stored in environment variables for portability
		 $user = 'root';
		$pass = 'kplus';

		// $user = 'workorder';
		// $pass = 'Dkny4@38';

		// 4. Open a connection to the database using PDO
		$db = new PDO('mysql:host=localhost;dbname=kplusindustrial_workorder', $user, $pass);
		// Make sure we are talking to the database in UTF-8
		$db->exec('SET NAMES utf8');

		// 5. Use PDO prepare to insert all the information into the database
		$sql = $db->prepare('SELECT signature FROM esignatures WHERE WorkOrderId='.$workorder_id.' AND `UserId`='.$user_id);		
		$sql->execute();
		while ($row = $sql->fetch(PDO::FETCH_COLUMN)) {
			$output=$row;
		}

		// 6. Trigger the display of the signature regeneration
		$show_form = false;
	} catch (PDOException $e) {
    print "Error!: " . $e->getMessage() . "<br/>";
    die();
	}

