Troubeshoots error displaying
parent
c245bbb3be
commit
686d2c1153
|
@ -13,10 +13,9 @@ function connectDB($config, $database = '', $dbFile = '', $platformId = '') {
|
||||||
'type' => 'sqlite',
|
'type' => 'sqlite',
|
||||||
'dbFile' => $dbFile,
|
'dbFile' => $dbFile,
|
||||||
]);
|
]);
|
||||||
|
return ['db' => $db, 'error' => null];
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$error = getError('Error connecting to DB.', $e->getMessage());
|
return ['db' => null, 'error' => getError('Error connecting to DB.', $e->getMessage())];
|
||||||
include '../app/templates/block-message.php';
|
|
||||||
exit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// connecting to a jilo-web database of the web app
|
// connecting to a jilo-web database of the web app
|
||||||
|
@ -30,10 +29,12 @@ function connectDB($config, $database = '', $dbFile = '', $platformId = '') {
|
||||||
'dbFile' => $config['db']['sqlite_file'],
|
'dbFile' => $config['db']['sqlite_file'],
|
||||||
]);
|
]);
|
||||||
$pdo = $db->getConnection();
|
$pdo = $db->getConnection();
|
||||||
|
return $db;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$error = getError('Error connecting to DB.', $e->getMessage());
|
$error = getError('Error connecting to DB.', $e->getMessage());
|
||||||
include '../app/templates/block-message.php';
|
return $error;
|
||||||
exit();
|
// include '../app/templates/block-message.php';
|
||||||
|
// exit();
|
||||||
}
|
}
|
||||||
// mysql/mariadb database
|
// mysql/mariadb database
|
||||||
} elseif ($config['db']['db_type'] === 'mysql' || $config['db']['db_type'] === 'mariadb') {
|
} elseif ($config['db']['db_type'] === 'mysql' || $config['db']['db_type'] === 'mariadb') {
|
||||||
|
@ -47,10 +48,12 @@ function connectDB($config, $database = '', $dbFile = '', $platformId = '') {
|
||||||
'password' => $config['db']['sql_password'],
|
'password' => $config['db']['sql_password'],
|
||||||
]);
|
]);
|
||||||
$pdo = $db->getConnection();
|
$pdo = $db->getConnection();
|
||||||
|
return $db;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$error = getError('Error connecting to DB.', $e->getMessage());
|
$error = getError('Error connecting to DB.', $e->getMessage());
|
||||||
include '../app/templates/block-message.php';
|
return $error;
|
||||||
exit();
|
// include '../app/templates/block-message.php';
|
||||||
|
// exit();
|
||||||
}
|
}
|
||||||
// unknown database
|
// unknown database
|
||||||
} else {
|
} else {
|
||||||
|
@ -61,6 +64,6 @@ function connectDB($config, $database = '', $dbFile = '', $platformId = '') {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $db;
|
// return $db;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -4,8 +4,13 @@ require '../app/classes/conference.php';
|
||||||
require '../app/classes/participant.php';
|
require '../app/classes/participant.php';
|
||||||
|
|
||||||
// connect to database
|
// connect to database
|
||||||
$db = connectDB($config, 'jilo', $platformDetails[0]['jilo_database'], $platform_id);
|
$response = connectDB($config, 'jilo', $platformDetails[0]['jilo_database'], $platform_id);
|
||||||
|
if ($response['db'] === null) {
|
||||||
|
$error = $response['error'];
|
||||||
|
include '../app/templates/block-message.php';
|
||||||
|
} else {
|
||||||
|
$db = $response['db'];
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// dashboard widget listings
|
// dashboard widget listings
|
||||||
|
|
|
@ -1,13 +1,24 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
// 'notice' for all non-critical messages
|
// 'error' for errors
|
||||||
if (isset($_SESSION['error'])) {
|
if (isset($_SESSION['error'])) {
|
||||||
echo "\t\t" . '<div class="error">' . $_SESSION['error'] . '</div>';
|
echo "\t\t" . '<div class="error">' . $_SESSION['error'] . '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// 'error' for errors
|
// 'notice' for all non-critical messages
|
||||||
if (isset($_SESSION['notice'])) {
|
if (isset($_SESSION['notice'])) {
|
||||||
echo "\t\t" . '<div class="notice">' . $_SESSION['notice'] . '</div>';
|
echo "\t\t" . '<div class="notice">' . $_SESSION['notice'] . '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 'error' for errors
|
||||||
|
if (isset($error)) {
|
||||||
|
echo "\t\t" . '<div class="error">' . $error . '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// 'notice' for all non-critical messages
|
||||||
|
if (isset($_SESSION['notice'])) {
|
||||||
|
echo "\t\t" . '<div class="notice">' . $_SESSION['notice'] . '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue