diff --git a/api/classes/Database.php b/api/classes/Database.php index 7f52793..2d43039 100644 --- a/api/classes/Database.php +++ b/api/classes/Database.php @@ -29,8 +29,10 @@ class Database { * Constructor */ function __construct() { - $this->DBH = new \PDO("mysql:host=localhost;dbname=".self::databaseName, + $this->DBH = new \PDO("mysql:host=localhost;dbname=".self::databaseName, self::userName, self::userPassword); + //$this->DBH->setAttribute( \PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION ); + //$this->DBH->setAttribute( \PDO::ATTR_EMULATE_PREPARES, FALSE ); $stmt = $this->DBH->prepare('SET NAMES utf8'); $stmt->execute(); } diff --git a/api/util/DBUtil.php b/api/util/DBUtil.php index be84ceb..01886f6 100644 --- a/api/util/DBUtil.php +++ b/api/util/DBUtil.php @@ -50,8 +50,8 @@ public static function updateDetail($db, $detail) { */ public static function addDetail($db, $detail) { $query = 'INSERT INTO `detail` ' - . '(`name`,`short_desc`,`long_desc`, `image_url`, `phone`, `website`,`cost`, `email`) ' - . 'VALUES (:name, :shortDesc, :longDesc, :imageURL, :phone, :website, :cost, :email)'; + . '(`name`,`short_desc`,`long_desc`, `image_url`, `thumb_url`, `phone`, `website`,`cost`, `email`) ' + . 'VALUES (:name, :shortDesc, :longDesc, :imageURL, :thumbURL, :phone, :website, :cost, :email)'; $stmt = $db->prepare($query); // Bind the Parameters @@ -59,6 +59,7 @@ public static function addDetail($db, $detail) { $stmt->bindParam(':shortDesc', $detail['shortDesc'], \PDO::PARAM_STR); $stmt->bindParam(':longDesc', $detail['longDesc'], \PDO::PARAM_STR); $stmt->bindParam(':imageURL', $detail['imageURL'], \PDO::PARAM_STR); + $stmt->bindParam(':thumbURL', $detail['thumbURL'], \PDO::PARAM_STR); $stmt->bindParam(':phone', $detail['phone'], \PDO::PARAM_STR); $stmt->bindParam(':website', $detail['website'], \PDO::PARAM_STR); $stmt->bindParam(':cost', $detail['cost'], \PDO::PARAM_INT);