summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--www/add.php2
-rw-r--r--www/common.php4
-rw-r--r--www/edit.php4
3 files changed, 7 insertions, 3 deletions
diff --git a/www/add.php b/www/add.php
index d70fca9..fe21344 100644
--- a/www/add.php
+++ b/www/add.php
@@ -45,7 +45,7 @@ try
}
catch(PDOException $e)
{
- result["error"] = "DB error:" . $e->getMessage();
+ $result["error"] = "DB error:" . $e->getMessage();
}
header("Content-type:application/json");
diff --git a/www/common.php b/www/common.php
index 52971eb..a86d7b7 100644
--- a/www/common.php
+++ b/www/common.php
@@ -19,10 +19,14 @@
function ConnectDB()
{
+ global $config;
+
$pdo = new PDO("mysql:host=localhost;dbname={$config["dbname"]}",
$config["dbuser"], $config["dbpassword"]);
+
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
return $pdo;
}
+
?>
diff --git a/www/edit.php b/www/edit.php
index 1c61148..9e78e88 100644
--- a/www/edit.php
+++ b/www/edit.php
@@ -35,7 +35,7 @@ try
$cmd = $db->prepare("UPDATE pm_store " .
"set description=:description, " .
"username=:username, " .
- "password=:password) where id = :id");
+ "password=:password where id = :id");
$cmd->bindParam(":id", $id);
$cmd->bindParam(":description", $description);
$cmd->bindParam(":username", $username);
@@ -48,7 +48,7 @@ try
}
catch(PDOException $e)
{
- result["error"] = "DB error:" . $e->getMessage();
+ $result["error"] = "DB error:" . $e->getMessage();
}
header("Content-type:application/json");