function getFromDb($id, $mysqlConfig)
{
    $mysqli = new mysqli($mysqlConfig['host'], $mysqlConfig['username'], $mysqlConfig['password'], $mysqlConfig['schema']);
    $mysqli->set_charset('utf8');
    $stmt = $mysqli->prepare("SELECT `dataBlob` FROM `schematics` WHERE id=?");
    $stmt->bind_param('i', $id);
    $stmt->execute();
    $stmt->bind_result($dataBlob);
    if (!$stmt->fetch()) {
        echo json_encode(array("error" => true, "errorDescription" => "No record found with ID {$id}"));
        exit;
    }
    $stmt->close();
    $dataBlob = gzdecode_prePhp6($dataBlob);
    //decompressing in javascript is much slower and because we are using HTTP compression, there is no substantial difference in size.
    $dataBlob = base64_encode($dataBlob);
    return $dataBlob;
}
            exitWithError("ID not set.");
        }
        if (!is_numeric($_GET["id"])) {
            exitWithError("ID not an integer.");
        }
        $recordId = $_GET["id"];
        $stmt = $mysqli->prepare("SELECT `data` FROM `schematics_tempholder` WHERE id=?");
        $stmt->bind_param('i', $recordId);
        $stmt->execute();
        $stmt->bind_result($dataBlob);
        if (!$stmt->fetch()) {
            exitWithError("No record found with ID {$recordId}.");
        }
        $stmt->close();
        ob_start("ob_gzhandler");
        //Enables GZIP compression.
        //header('Content-type: text/plain; charset=x-user-defined');
        header('Content-Type: text/html; charset=UTF-8');
        $dataBlob = gzdecode_prePhp6($dataBlob);
        //Slower in Javascript than in PHP and HTTP compression makes the size difference a non-issue
        $dataBlob = base64_encode($dataBlob);
        //Base64 encoding means json_encoding doesn't need to encode any characters, resulting in smaller string size. GZip compress also seems to be really effective on base64 strings
        //$dataBlob = json_encode($dataBlob); //JSON decoding big strings is *slow* in Javascript
        echo $dataBlob;
        //Delete the record:
        $stmt = $mysqli->prepare("DELETE FROM `schematics_tempholder` WHERE id=?");
        $stmt->bind_param('i', $recordId);
        $stmt->execute();
        $stmt->close();
        break;
}