prepare($insertQuery); if ($stmt == false) { print_r($conn->errorInfo()); fatalError("sqlsrv_prepare failed\n"); } // Execute the INSERT query // This should not fail since our credentials are correct if ($stmt->execute($testValues) == false) { print_r($stmt->errorInfo()); fatalError("INSERT query execution failed with good credentials.\n"); } else { // Get the data back and compare encrypted and non-encrypted versions $selectQuery = "SELECT * FROM $tableName"; $stmt1 = $conn->query($selectQuery); $data = $stmt1->fetchAll(PDO::FETCH_NUM); $data = $data[0]; if (sizeof($data) != 2*sizeof($dataTypes)) { fatalError("Incorrect number of fields returned.\n"); } for ($n = 0; $n < sizeof($data); $n += 2) { if ($data[$n] != $data[$n + 1]) { echo "Failed on field $n: ".$data[$n]." ".$data[$n + 1]."\n"; fatalError("AE and non-AE values do not match.\n"); } } unset($stmt); unset($stmt1); } // Drop the table dropTable($conn, $tableName); } ?>