diff --git a/api/util/DBUtil.php b/api/util/DBUtil.php index be84ceb..2dca2dd 100644 --- a/api/util/DBUtil.php +++ b/api/util/DBUtil.php @@ -54,6 +54,7 @@ public static function addDetail($db, $detail) { . 'VALUES (:name, :shortDesc, :longDesc, :imageURL, :phone, :website, :cost, :email)'; $stmt = $db->prepare($query); + $email = !empty($detail['email']) ? $detail['email'] : ''; // Bind the Parameters $stmt->bindParam(':name', $detail['name'], \PDO::PARAM_STR); $stmt->bindParam(':shortDesc', $detail['shortDesc'], \PDO::PARAM_STR); @@ -62,7 +63,7 @@ public static function addDetail($db, $detail) { $stmt->bindParam(':phone', $detail['phone'], \PDO::PARAM_STR); $stmt->bindParam(':website', $detail['website'], \PDO::PARAM_STR); $stmt->bindParam(':cost', $detail['cost'], \PDO::PARAM_INT); - $stmt->bindParam(':email', $detail['email'], \PDO::PARAM_STR); + $stmt->bindParam(':email', $email, \PDO::PARAM_STR); $stmt->execute(); $detailId = $db->getLastInsertId(); diff --git a/public_html/pages/javascript/destinations.js b/public_html/pages/javascript/destinations.js index 5c17a1a..9de9735 100644 --- a/public_html/pages/javascript/destinations.js +++ b/public_html/pages/javascript/destinations.js @@ -189,9 +189,13 @@ evnApp.controller('EditDestCtrl', function EditDestCtrl( // Update the event if we have a detailId if (detailId) { $http.post('/adminApi/updateDest', - {'dest': $scope.dest}); - $scope.uploadDestImages(detailId); - $scope.$parent.getDestinations('name', 'ASC'); + {'dest': $scope.dest}) + .then(function(response) { + $scope.uploadDestImages(detailId); + $scope.$parent.getDestinations('name', 'ASC'); + }).catch(function(reason) { + console.log(reason); + }); } else { // Add a new event $http.post('/adminApi/addDest',