Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion api/classes/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
5 changes: 3 additions & 2 deletions api/util/DBUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,16 @@ 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
$stmt->bindParam(':name', $detail['name'], \PDO::PARAM_STR);
$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);
Expand Down