Fixed loading.... issue when no data returned

This commit is contained in:
laf
2015-04-12 11:47:21 +01:00
parent d2bb7d7137
commit 71f5f22387
9 changed files with 25 additions and 0 deletions

View File

@@ -39,6 +39,7 @@ if (isset($_POST['sort']) && is_array($_POST['sort'])) {
}
$searchPhrase = mres($_POST['searchPhrase']);
$id = mres($_POST['id']);
$response = array();
if (isset($id)) {
if (file_exists("includes/table/$id.inc.php")) {

View File

@@ -28,6 +28,9 @@ if ($_POST['search_type'] == 'ipv4') {
$count_sql = "SELECT COUNT(`port_id`) $sql";
}
$total = dbFetchCell($count_sql,$param);
if (empty($total)) {
$total = 0;
}
if (!isset($sort) || empty($sort)) {
$sort = '`hostname` ASC';

View File

@@ -20,6 +20,9 @@ if (isset($searchPhrase) && !empty($searchPhrase)) {
$count_sql = "SELECT COUNT(`E`.`id`) $sql";
$total = dbFetchCell($count_sql,$param);
if (empty($total)) {
$total = 0;
}
if (!isset($sort) || empty($sort)) {
$sort = 'time_logged DESC';

View File

@@ -15,6 +15,9 @@ $sql = " FROM `alerts` LEFT JOIN `devices` ON `alerts`.`device_id`=`devices`.`de
$count_sql = "SELECT COUNT(`alerts`.`id`) $sql";
$total = dbFetchCell($count_sql,$param);
if (empty($total)) {
$total = 0;
}
if (!isset($sort) || empty($sort)) {
$sort = 'timestamp DESC';

View File

@@ -20,6 +20,9 @@ if (is_numeric($_POST['device_id'])) {
$count_sql = "SELECT COUNT(`M`.`port_id`) $sql";
$total = dbFetchCell($count_sql,$param);
if (empty($total)) {
$total = 0;
}
if (!isset($sort) || empty($sort)) {
$sort = '`hostname` ASC';

View File

@@ -39,6 +39,9 @@ if( !empty($_POST['group']) ) {
$count_sql = "SELECT COUNT(`device_id`) $sql";
$total = dbFetchCell($count_sql,$param);
if (empty($total)) {
$total = 0;
}
if (!isset($sort) || empty($sort)) {
$sort = '`hostname` DESC';

View File

@@ -27,6 +27,9 @@ if (isset($searchPhrase) && !empty($searchPhrase)) {
$count_sql = "SELECT COUNT(datetime) $sql";
$total = dbFetchCell($count_sql,$param);
if (empty($total)) {
$total = 0;
}
if (!isset($sort) || empty($sort)) {
$sort = 'datetime DESC';

View File

@@ -43,6 +43,9 @@ if (isset($_POST['device']) && is_numeric($_POST['device'])) {
$count_sql = "SELECT COUNT(`entPhysical_id`) $sql";
$total = dbFetchCell($count_sql,$param);
if (empty($total)) {
$total = 0;
}
if (!isset($sort) || empty($sort)) {
$sort = '`hostname` DESC';

View File

@@ -18,6 +18,9 @@ if (!isset($sort) || empty($sort)) {
$count_sql = "SELECT COUNT(`D`.`device_id`) $sql";
$total = dbFetchCell($count_sql);
if (empty($total)) {
$total = 0;
}
$sql .= " AND D.status ='1' AND D.ignore='0' AND D.disabled='0' ORDER BY $sort";