Better error handling for undefined/non-existent asset IDs
This commit is contained in:
@@ -21,8 +21,14 @@ if (isset($_GET['asset_id'])) {
|
|||||||
LEFT JOIN asset_interfaces ON interface_asset_id = asset_id AND interface_primary = 1
|
LEFT JOIN asset_interfaces ON interface_asset_id = asset_id AND interface_primary = 1
|
||||||
WHERE asset_id = $asset_id
|
WHERE asset_id = $asset_id
|
||||||
$client_query
|
$client_query
|
||||||
|
LIMIT 1
|
||||||
");
|
");
|
||||||
|
|
||||||
|
if (mysqli_num_rows($sql) == 0) {
|
||||||
|
echo "<center><h1 class='text-secondary mt-5'>Nothing to see here</h1><a class='btn btn-lg btn-secondary mt-3' href='tickets.php'><i class='fa fa-fw fa-arrow-left'></i> Go Back</a></center>";
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_array($sql);
|
||||||
$client_id = intval($row['client_id']);
|
$client_id = intval($row['client_id']);
|
||||||
$client_name = nullable_htmlentities($row['client_name']);
|
$client_name = nullable_htmlentities($row['client_name']);
|
||||||
@@ -1225,4 +1231,6 @@ require_once "modals/credential/credential_add.php";
|
|||||||
require_once "modals/document/document_add.php";
|
require_once "modals/document/document_add.php";
|
||||||
require_once "modals/file/file_upload.php";
|
require_once "modals/file/file_upload.php";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|||||||
Reference in New Issue
Block a user